linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [RFC PATCH 00/13] Implement NFSv4 delegations, take 4
@ 2012-09-05 20:55 J. Bruce Fields
       [not found] ` <1346878524-10585-1-git-send-email-bfields-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
                   ` (7 more replies)
  0 siblings, 8 replies; 32+ messages in thread
From: J. Bruce Fields @ 2012-09-05 20:55 UTC (permalink / raw)
  To: Al Viro; +Cc: linux-nfs, linux-fsdevel, J. Bruce Fields

From: "J. Bruce Fields" <bfields@redhat.com>

Older NFS clients can only find out about changes to a file by polling.
NFSv4 instead allows a client to get a "delegation" on a file and then
operate on a file without talking to the server.  Consistency is
maintained by requiring the server to recall the delegation before
allowing any conflicting operation.

But our kfsd doesn't always recall delegations on conflicting operations
from local (non-NFS) users of an exported filesystem.

This patch series fixes that by defining a new lock type to represent a
delegation.  This new lock type isn't available to userspace for
now--nfsd is the only user.

Delegations come in both "read" and "write" flavors, but I'm only
implementing read delegations for now.

Delegations are similar to leases.  The main difference is that
delegations need to be broken on any operation that changes a file's
attributes or the set of links pointing to it (like link, unlink, and
rename).

Such operations take several locks (including at least one i_mutex on a
directory).  Delegations can take a long time (about a minute) to recall
when NFS clients are unresponsive.  To avoid blocking a lot of unrelated
operations, this version of the patches drops all of those locks before
waiting.

To that end, I'm passing an extra inode ** to functions like vfs_unlink.
When vfs_unlink finds a delegation it can then pass back the offending
inode so that the caller can wait for the delegation recall.  If the
caller passes in NULL, then it instead gets -EWOULDBLOCK on encountering
a delegation.

In fact, callers outside the vfs are mostly passing in NULL:

	- nfsd wants to imediately return NFS4ERR_DELAY to callers on
	  encountering a delegation, instead of waiting.
	- I assume that anyone exporting the fileystem underlying an
	  ecryptfs mount is making a mistake, and that it's better to
	  return an error than to wait.
	- Ditto for fscache.

But those other callers could be taught to wait as well if necessary.

At least in the link case, these patches may currently have the same
problem Jeff Layton's ESTALE patches hit (some code paths that look safe
to retry aren't, due to some audit code).

I think this is about the 4th version posted.  The previous version
didn't drop locks before waiting.

--b.

J. Bruce Fields (12):
  vfs: pull ext4's double-i_mutex-locking into common code
  vfs: don't use PARENT/CHILD lock classes for non-directories
  vfs: rename I_MUTEX_QUOTA now that it's not used for quotas
  vfs: take i_mutex on renamed file
  locks: introduce new FL_DELEG lock flag
  locks: implement delegations
  namei: minor vfs_unlink cleanup
  locks: break delegations on unlink
  locks: helper functions for delegation breaking
  locks: break delegations on rename
  locks: break delegations on link
  locks: break delegations on any attribute modification

Jan Kara (1):
  gfs2: Get rid of I_MUTEX_QUOTA usage

 Documentation/filesystems/directory-locking |   30 +++++++----
 drivers/base/devtmpfs.c                     |    6 +--
 fs/attr.c                                   |    5 +-
 fs/cachefiles/interface.c                   |    4 +-
 fs/cachefiles/namei.c                       |    4 +-
 fs/ecryptfs/inode.c                         |    6 +--
 fs/ext4/move_extent.c                       |   21 +-------
 fs/gfs2/ops_fstype.c                        |    8 +++
 fs/gfs2/quota.c                             |    2 +-
 fs/hpfs/namei.c                             |    2 +-
 fs/inode.c                                  |   42 ++++++++++++++-
 fs/locks.c                                  |   51 ++++++++++++++----
 fs/namei.c                                  |   74 ++++++++++++++++++++-------
 fs/nfsd/nfs4state.c                         |    2 +-
 fs/nfsd/vfs.c                               |   14 +++--
 fs/open.c                                   |   21 ++++++--
 fs/utimes.c                                 |    9 +++-
 include/linux/fs.h                          |   72 +++++++++++++++++++++-----
 ipc/mqueue.c                                |    2 +-
 19 files changed, 280 insertions(+), 95 deletions(-)

-- 
1.7.9.5


^ permalink raw reply	[flat|nested] 32+ messages in thread

end of thread, other threads:[~2013-02-14  2:02 UTC | newest]

Thread overview: 32+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-09-05 20:55 [RFC PATCH 00/13] Implement NFSv4 delegations, take 4 J. Bruce Fields
     [not found] ` <1346878524-10585-1-git-send-email-bfields-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2012-09-05 20:55   ` [RFC PATCH 01/13] gfs2: Get rid of I_MUTEX_QUOTA usage J. Bruce Fields
     [not found]     ` <1346878524-10585-2-git-send-email-bfields-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2012-09-05 20:59       ` J. Bruce Fields
     [not found]         ` <20120905205920.GA10724-uC3wQj2KruNg9hUCZPvPmw@public.gmane.org>
2012-09-06 14:27           ` Steven Whitehouse
2012-09-06 17:08             ` J. Bruce Fields
2012-09-05 20:55   ` [RFC PATCH 02/13] vfs: pull ext4's double-i_mutex-locking into common code J. Bruce Fields
2012-09-06  2:53     ` Guo Chao
2012-09-06 13:49       ` J. Bruce Fields
2012-09-05 20:55   ` [RFC PATCH 05/13] vfs: take i_mutex on renamed file J. Bruce Fields
     [not found]     ` <1346878524-10585-6-git-send-email-bfields-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2012-09-06  3:05       ` Guo Chao
2012-09-06 17:51         ` J. Bruce Fields
     [not found]           ` <20120906175118.GC21736-uC3wQj2KruNg9hUCZPvPmw@public.gmane.org>
2012-09-07  2:27             ` Guo Chao
2012-09-07 21:39               ` J. Bruce Fields
     [not found]                 ` <20120907213901.GA5927-uC3wQj2KruNg9hUCZPvPmw@public.gmane.org>
2012-09-10  2:40                   ` Guo Chao
2012-09-10  5:10                     ` Ram Pai
2012-09-10  6:37                       ` Guo Chao
2012-09-10  7:27                         ` Ram Pai
2013-02-14  2:01                           ` Al Viro
2012-09-10 14:35                     ` J. Bruce Fields
2012-09-05 20:55   ` [RFC PATCH 06/13] locks: introduce new FL_DELEG lock flag J. Bruce Fields
2012-09-05 20:55   ` [RFC PATCH 08/13] namei: minor vfs_unlink cleanup J. Bruce Fields
2012-09-05 20:55   ` [RFC PATCH 11/13] locks: break delegations on rename J. Bruce Fields
2012-09-05 20:55 ` [RFC PATCH 03/13] vfs: don't use PARENT/CHILD lock classes for non-directories J. Bruce Fields
2012-09-05 20:55 ` [RFC PATCH 04/13] vfs: rename I_MUTEX_QUOTA now that it's not used for quotas J. Bruce Fields
2012-09-05 20:55 ` [RFC PATCH 07/13] locks: implement delegations J. Bruce Fields
2012-09-05 20:55 ` [RFC PATCH 09/13] locks: break delegations on unlink J. Bruce Fields
2012-09-05 20:55 ` [RFC PATCH 10/13] locks: helper functions for delegation breaking J. Bruce Fields
2012-09-05 20:55 ` [RFC PATCH 12/13] locks: break delegations on link J. Bruce Fields
2012-09-05 21:02   ` J. Bruce Fields
2012-09-06 11:01     ` Jeff Layton
     [not found]       ` <20120906070122.58c21013-4QP7MXygkU+dMjc06nkz3ljfA9RmPOcC@public.gmane.org>
2012-09-06 13:33         ` J. Bruce Fields
2012-09-05 20:55 ` [RFC PATCH 13/13] locks: break delegations on any attribute modification J. Bruce Fields

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).