Skip to content

locks: internal lease API overhaul

Jeff Layton cluster-devel linux-fsdevel linux-nfs lkml 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v2 Latest17 patches 31 repliesIn review

Changes in v2 from the cover letter

- cleanups and fixes in response to HCH's review
- make security_file_set_fowner a void return operation
- consolidate "nosetlease" routines
- remove "deadlock protection" from generic_add_lease routine
- add return value to lm_break op to allow for direct lease removal

Patches in v2 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/17locks: consolidate "nolease" routinesfs/gfs2/file.c fs/libfs.c fs/nfs/file.c +3 more+20 -356 replies
2/17security: make security_file_set_fowner, f_setown and __f_setown void returndrivers/net/tun.c drivers/tty/tty_io.c fs/fcntl.c +9 more+25 -415 replies
3/17locks: close potential race in lease_get_mtimefs/locks.c+12 -20 replies
4/17nfsd: fix potential lease memory leak in nfs4_setleasefs/nfsd/nfs4state.c+5 -20 replies
5/17locks: generic_delete_lease doesn't need a file_lock at allfs/locks.c fs/nfsd/nfs4state.c include/trace/events/filelock.h+22 -285 replies
6/17locks: clean up vfs_setlease kerneldoc commentsfs/locks.c+10 -240 replies
7/17nfsd: don't keep a pointer to the lease in nfs4_filefs/nfsd/nfs4state.c fs/nfsd/state.h+4 -72 replies
8/17locks: plumb a "priv" pointer into the setlease routinesfs/cifs/cifsfs.c fs/libfs.c fs/locks.c +2 more+35 -241 reply
9/17locks: define a lm_setup handler for leasesfs/locks.c fs/nfsd/nfs4state.c include/linux/fs.h+51 -481 reply
10/17locks: move i_lock acquisition into generic_*_lease handlersfs/locks.c+9 -120 replies
11/17locks: move freeing of leases outside of i_lockfs/locks.c fs/nfsd/nfs4state.c include/linux/fs.h+29 -182 replies
12/17locks: update Documentation/filesystems with new setlease semanticsDocumentation/filesystems/Locking Documentation/filesystems/vfs.txt+10 -82 replies
13/17locks: remove i_have_this_lease check from __break_leasefs/locks.c+2 -42 replies
14/17locks: __break_lease cleanup in preparation of allowing direct removal of leasesfs/locks.c+25 -242 replies
15/17locks: give lm_break a return valuefs/locks.c fs/nfsd/nfs4state.c include/linux/fs.h+23 -131 reply
16/17locks: set fl_owner for leases to filp instead of current->filesfs/locks.c+1 -10 replies
17/17locks: clean up comments over fl_owner_t definitioninclude/linux/fs.h+12 -42 replies

Reviews trailers per patch

14 of 17 patches have a Reviewed-by or Acked-by.

PatchChristoph HellwigTrond Myklebust
1/17R-b A-b
2/17R-b
3/17R-b
4/17R-b
5/17R-b
6/17R-b
7/17R-b
8/17R-b
9/17R-b
10/17R-b
11/17R-b
12/17R-b
13/17
14/17R-b
15/17R-b
16/17
17/17

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v2 thread

Cover letter [PATCH v2 00/17] locks: internal lease API overhaul

v2:
- cleanups and fixes in response to HCH's review
- make security_file_set_fowner a void return operation
- consolidate "nosetlease" routines
- remove "deadlock protection" from generic_add_lease routine
- add return value to lm_break op to allow for direct lease removal

The internal "API" for handling leases has a lot of problems. The main one is that on success it can return a pointer to a lease that sits on the inode's i_flock list. That pointer is only guaranteed to be valid until the i_lock is dropped, which makes it a bit dangerous to use.

Also, the i_lock is held over much too much of the code, which precludes any hope of ever adding proper support for leases to distributed filesystems.

This patchset is a cleanup and overhaul of the internal lease API, and a few stray locking-related patches. It fixes a number of problems in that code and makes an attempt at making that API more sane to use.

The only real consumer of that API is knfsd, but this should make it easier for others to do so, reduce and clarify the spinlocking involved in handling leases, and get us a step closer toward allowing lease implementations that can block.

I'm targeting this work for v3.18. Review would be welcome...

Jeff Layton (17):
locks: consolidate "nolease" routines
security: make security_file_set_fowner, f_setown and __f_setown void
return
locks: close potential race in lease_get_mtime
nfsd: fix potential lease memory leak in nfs4_setlease
locks: generic_delete_lease doesn't need a file_lock at all
locks: clean up vfs_setlease kerneldoc comments
nfsd: don't keep a pointer to the lease in nfs4_file
locks: plumb a "priv" pointer into the setlease routines
locks: define a lm_setup handler for leases
locks: move i_lock acquisition into generic_*_lease handlers
locks: move freeing of leases outside of i_lock
locks: update Documentation/filesystems with new setlease semantics
locks: remove i_have_this_lease check from __break_lease
locks: __break_lease cleanup in preparation of allowing direct removal
of leases
locks: give lm_break a return value
locks: set fl_owner for leases to filp instead of current->files
locks: clean up comments over fl_owner_t definition

 Documentation/filesystems/Locking |  11 +-
 Documentation/filesystems/vfs.txt |   7 +-
 drivers/net/tun.c                 |   4 +-
 drivers/tty/tty_io.c              |   3 +-
 fs/cifs/cifsfs.c                  |   7 +-
 fs/fcntl.c                        |  21 +--
 fs/gfs2/file.c                    |  22 +--
 fs/libfs.c                        |  18 +++
 fs/locks.c                        | 297 ++++++++++++++++++++------------------
 fs/nfs/file.c                     |  13 +-
 fs/nfs/internal.h                 |   1 -
 fs/nfs/nfs4file.c                 |   2 +-
 fs/nfsd/nfs4state.c               |  44 +++---
 fs/nfsd/state.h                   |   1 -
 fs/notify/dnotify/dnotify.c       |   8 +-
 include/linux/fs.h                |  41 ++++--
 include/linux/security.h          |   8 +-
 include/trace/events/filelock.h   |  14 +-
 net/socket.c                      |   3 +-
 security/capability.c             |   4 +-
 security/security.c               |   2 +-
 security/selinux/hooks.c          |   4 +-
 security/smack/smack_lsm.c        |   3 +-
 23 files changed, 269 insertions(+), 269 deletions(-)
Signature · 1 line
1.9.3