]> git.karo-electronics.de Git - karo-tx-linux.git/commit
locks: ensure that fl_owner is always initialized properly in flock and lease codepaths
authorJeff Layton <jlayton@poochiereds.net>
Wed, 30 Apr 2014 17:28:24 +0000 (13:28 -0400)
committerJeff Layton <jlayton@poochiereds.net>
Wed, 30 Apr 2014 17:28:24 +0000 (13:28 -0400)
commit96eebd3127165ea7ee239b1071a8bc47569a595d
treecd1abe5a624c085885359472272ee52d437495ad
parent8c836fa85bebfea26ceff024b5d1c518bf63f3d8
locks: ensure that fl_owner is always initialized properly in flock and lease codepaths

Currently, the fl_owner isn't set for flock locks. Some filesystems use
byte-range locks to simulate flock locks and there is a common idiom in
those that does:

    fl->fl_owner = (fl_owner_t)filp;
    fl->fl_start = 0;
    fl->fl_end = OFFSET_MAX;

Since flock locks are generally "owned" by the open file description,
move this into the common flock lock setup code. The fl_start and fl_end
fields are already set appropriately, so remove the unneeded setting of
that in flock ops in those filesystems as well.

Finally, the lease code also sets the fl_owner as if they were owned by
the process and not the open file description. This is incorrect as
leases have the same ownership semantics as flock locks. Set them the
same way. The lease code doesn't actually use the fl_owner value for
anything, so this is more for consistency's sake than a bugfix.

Reported-by: Trond Myklebust <trond.myklebust@primarydata.com>
Signed-off-by: Jeff Layton <jlayton@poochiereds.net>
Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> (Staging portion)
drivers/staging/lustre/lustre/llite/file.c
fs/9p/vfs_file.c
fs/afs/flock.c
fs/ceph/locks.c
fs/fuse/file.c
fs/locks.c
fs/nfs/file.c