[Lustre-discuss] Lustre File Locking not locking

Bernd Schubert bs at q-leap.de
Thu Aug 21 03:23:05 PDT 2008


Hello Darren,

On Thursday 21 August 2008 11:32:45 Darren George wrote:
> Hi Bernd,
>
> Thanks for your quick responce.
> I am indeed using the servers as lustre clients as well.
> I see the following from messages log on the server the windows client
> is connected to
>
> localhost kernel: LustreError: 32074:0:(file.c:2570:ll_file_flock()) LBUG
> Aug 21 17:06:12 localhost kernel: LustreError:
> 32074:0:(file.c:2569:ll_file_flock()) unknown fcntl lock type: 96

doh, what it type 96? From include/asm-generic/fcntl.h:

/* for posix fcntl() and lockf() */
#ifndef F_RDLCK
#define F_RDLCK		0
#define F_WRLCK		1
#define F_UNLCK		2
#endif

Now you run into a rather ugly programming technique of the Lustre 
developers, rather often they simply call LBUG(), although the 
problem is not grave:

In lustre/llite/file.c:

        switch (file_lock->fl_type) {
        case F_RDLCK:
                einfo.ei_mode = LCK_PR;
                break;
        case F_UNLCK:
                /* An unlock request may or may not have any relation to
                 * existing locks so we may not be able to pass a lock handle
                 * via a normal ldlm_lock_cancel() request. The request may even
                 * unlock a byte range in the middle of an existing lock. In
                 * order to process an unlock request we need all of the same
                 * information that is given with a normal read or write record
                 * lock request. To avoid creating another ldlm unlock (cancel)
                 * message we'll treat a LCK_NL flock request as an unlock. */
                einfo.ei_mode = LCK_NL;
                break;
        case F_WRLCK:
                einfo.ei_mode = LCK_PW;
                break;
        default:
                CERROR("unknown fcntl lock type: %d\n", file_lock->fl_type);
                LBUG();
        }

IHMO, instead of calling LBUG() here, simply "return EINVAL" should be done.
So with the present code it seems whenever the userspace is setting a 
wrong struct flock l_type, it will trigger a LBUG(). I'm going to check this
and then will fill in a bugzilla entry.


Cheers,
Bernd


-- 
Bernd Schubert
Q-Leap Networks GmbH



More information about the lustre-discuss mailing list