* [PATCH] nfsd4: fix minorversion support interface
@ 2013-07-12 21:40 J. Bruce Fields
0 siblings, 0 replies; 3+ messages in thread
From: J. Bruce Fields @ 2013-07-12 21:40 UTC (permalink / raw)
To: linux-nfs
From: "J. Bruce Fields" <bfields@redhat.com>
You can turn on or off support for minorversions using e.g.
echo "-4.2" >/proc/fs/nfsd/versions
However, the current implementation is a little wonky. For example, the
above will turn off 4.2 support, but it will also turn *on* 4.1 support.
This didn't matter as long as we only had 2 minorversions, which was
true till very recently.
And do a little cleanup here.
Signed-off-by: J. Bruce Fields <bfields@redhat.com>
---
fs/nfsd/nfs4proc.c | 2 +-
fs/nfsd/nfsd.h | 1 -
fs/nfsd/nfssvc.c | 13 +++++++------
3 files changed, 8 insertions(+), 8 deletions(-)
For 3.11.
diff --git a/fs/nfsd/nfs4proc.c b/fs/nfsd/nfs4proc.c
index a7cee86..0d4c410 100644
--- a/fs/nfsd/nfs4proc.c
+++ b/fs/nfsd/nfs4proc.c
@@ -1293,7 +1293,7 @@ nfsd4_proc_compound(struct svc_rqst *rqstp,
* According to RFC3010, this takes precedence over all other errors.
*/
status = nfserr_minor_vers_mismatch;
- if (args->minorversion > nfsd_supported_minorversion)
+ if (nfsd_minorversion(args->minorversion, NFSD_TEST) <= 0)
goto out;
status = nfs41_check_op_ordering(args);
diff --git a/fs/nfsd/nfsd.h b/fs/nfsd/nfsd.h
index 2bbd94e..30f34ab 100644
--- a/fs/nfsd/nfsd.h
+++ b/fs/nfsd/nfsd.h
@@ -53,7 +53,6 @@ struct readdir_cd {
extern struct svc_program nfsd_program;
extern struct svc_version nfsd_version2, nfsd_version3,
nfsd_version4;
-extern u32 nfsd_supported_minorversion;
extern struct mutex nfsd_mutex;
extern spinlock_t nfsd_drc_lock;
extern unsigned long nfsd_drc_max_mem;
diff --git a/fs/nfsd/nfssvc.c b/fs/nfsd/nfssvc.c
index 6b9f48c..760c85a 100644
--- a/fs/nfsd/nfssvc.c
+++ b/fs/nfsd/nfssvc.c
@@ -116,7 +116,10 @@ struct svc_program nfsd_program = {
};
-u32 nfsd_supported_minorversion = 1;
+static bool nfsd_supported_minorversions[NFSD_SUPPORTED_MINOR_VERSION + 1] = {
+ [0] = 1,
+ [1] = 1,
+};
int nfsd_vers(int vers, enum vers_op change)
{
@@ -151,15 +154,13 @@ int nfsd_minorversion(u32 minorversion, enum vers_op change)
return -1;
switch(change) {
case NFSD_SET:
- nfsd_supported_minorversion = minorversion;
+ nfsd_supported_minorversions[minorversion] = true;
break;
case NFSD_CLEAR:
- if (minorversion == 0)
- return -1;
- nfsd_supported_minorversion = minorversion - 1;
+ nfsd_supported_minorversions[minorversion] = false;
break;
case NFSD_TEST:
- return minorversion <= nfsd_supported_minorversion;
+ return nfsd_supported_minorversions[minorversion];
case NFSD_AVAIL:
return minorversion <= NFSD_SUPPORTED_MINOR_VERSION;
}
--
1.7.9.5
^ permalink raw reply related [flat|nested] 3+ messages in thread* [PATCH 00/16] Implement NFSv4 delegations, take 9
@ 2013-07-17 20:50 J. Bruce Fields
2013-07-17 20:50 ` [PATCH] nfsd4: fix minorversion support interface J. Bruce Fields
0 siblings, 1 reply; 3+ messages in thread
From: J. Bruce Fields @ 2013-07-17 20:50 UTC (permalink / raw)
To: Al Viro; +Cc: linux-nfs, linux-fsdevel, jlayton, Dave Chinner, J. Bruce Fields
From: "J. Bruce Fields" <bfields@redhat.com>
Changes since version 8, thanks to dchinner and jlayton for review:
- additional warnings in lock_two_nondirectories
- lock_two_nondirectories handles NULL second argument,
simplifying vfs_rename_other
- kerneldoc comments on notify_change, vfs_link, vfs_rename,
vfs_unlink, to explain delegated_inode argument.
- make clear non-support of write delegations in
generic_add_lease
- rebase to 3.11-rc1
Introduction copied from previous posting:
This patch series implements read delegations, which allow NFSv4 clients
to perform read opens without contacting the server, by promising to
call back to clients before modifying the data, metadata, or set of
links pointing to a file.
The main recent change was in response to review from Linus, who didn't
want us to hang under directory i_mutex's on timeouts communicating with
unresponsive clients.
So, this version of the series drops the i_mutex before waiting. The
logic ends up looking something like:
acquire locks
look up inode
test for delegation; if found:
take reference on inode
release locks
wait for delegation break
drop reference on inode
retry
The initial test for a delegation happens after the lock on the
delegated inode is acquired, but additional directory mutexes may have
been acquired further up the call stack. I therefore add a "struct
inode **" argument to any intervening functions, which we use to pass
the inode back up to the caller in the case it needs to wait for the
delegation to be broken.
I also allow callers to pass in NULL for the "struct inode **" argument
to indicate they'd rather just fail than wait for a delegation. For
example, as long as ecryptfs isn't exportable I assume they'd rather not
see retry logic there that they won't use. But I may have misjudged in
some of these cases.
J. Bruce Fields (16):
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
nfsd4: minor nfs4_setlease cleanup
nfsd4: delay setting current_fh in open
nfsd4: close open-deleg/unlink/rename race
nfsd4: break only delegations when appropriate
Documentation/filesystems/directory-locking | 31 ++++--
drivers/base/devtmpfs.c | 6 +-
fs/attr.c | 25 ++++-
fs/cachefiles/interface.c | 4 +-
fs/cachefiles/namei.c | 4 +-
fs/ecryptfs/inode.c | 6 +-
fs/ext4/ext4.h | 2 -
fs/ext4/ioctl.c | 4 +-
fs/ext4/move_extent.c | 40 +-------
fs/hpfs/namei.c | 2 +-
fs/inode.c | 42 ++++++++-
fs/locks.c | 57 ++++++++---
fs/namei.c | 135 +++++++++++++++++++++++----
fs/nfsd/nfs4proc.c | 36 +++----
fs/nfsd/nfs4state.c | 66 ++++++++++---
fs/nfsd/vfs.c | 41 ++------
fs/nfsd/xdr4.h | 3 +-
fs/open.c | 22 ++++-
fs/utimes.c | 9 +-
include/linux/fs.h | 72 +++++++++++---
ipc/mqueue.c | 2 +-
21 files changed, 433 insertions(+), 176 deletions(-)
--
1.7.9.5
^ permalink raw reply [flat|nested] 3+ messages in thread* [PATCH] nfsd4: fix minorversion support interface
2013-07-17 20:50 [PATCH 00/16] Implement NFSv4 delegations, take 9 J. Bruce Fields
@ 2013-07-17 20:50 ` J. Bruce Fields
2013-07-17 21:08 ` J. Bruce Fields
0 siblings, 1 reply; 3+ messages in thread
From: J. Bruce Fields @ 2013-07-17 20:50 UTC (permalink / raw)
To: Al Viro; +Cc: linux-nfs, linux-fsdevel, jlayton, Dave Chinner, J. Bruce Fields
From: "J. Bruce Fields" <bfields@redhat.com>
You can turn on or off support for minorversions using e.g.
echo "-4.2" >/proc/fs/nfsd/versions
However, the current implementation is a little wonky. For example, the
above will turn off 4.2 support, but it will also turn *on* 4.1 support.
This didn't matter as long as we only had 2 minorversions, which was
true till very recently.
And do a little cleanup here.
Signed-off-by: J. Bruce Fields <bfields@redhat.com>
---
fs/nfsd/nfs4proc.c | 2 +-
fs/nfsd/nfsd.h | 1 -
fs/nfsd/nfssvc.c | 13 +++++++------
3 files changed, 8 insertions(+), 8 deletions(-)
diff --git a/fs/nfsd/nfs4proc.c b/fs/nfsd/nfs4proc.c
index a7cee86..0d4c410 100644
--- a/fs/nfsd/nfs4proc.c
+++ b/fs/nfsd/nfs4proc.c
@@ -1293,7 +1293,7 @@ nfsd4_proc_compound(struct svc_rqst *rqstp,
* According to RFC3010, this takes precedence over all other errors.
*/
status = nfserr_minor_vers_mismatch;
- if (args->minorversion > nfsd_supported_minorversion)
+ if (nfsd_minorversion(args->minorversion, NFSD_TEST) <= 0)
goto out;
status = nfs41_check_op_ordering(args);
diff --git a/fs/nfsd/nfsd.h b/fs/nfsd/nfsd.h
index 2bbd94e..30f34ab 100644
--- a/fs/nfsd/nfsd.h
+++ b/fs/nfsd/nfsd.h
@@ -53,7 +53,6 @@ struct readdir_cd {
extern struct svc_program nfsd_program;
extern struct svc_version nfsd_version2, nfsd_version3,
nfsd_version4;
-extern u32 nfsd_supported_minorversion;
extern struct mutex nfsd_mutex;
extern spinlock_t nfsd_drc_lock;
extern unsigned long nfsd_drc_max_mem;
diff --git a/fs/nfsd/nfssvc.c b/fs/nfsd/nfssvc.c
index 6b9f48c..760c85a 100644
--- a/fs/nfsd/nfssvc.c
+++ b/fs/nfsd/nfssvc.c
@@ -116,7 +116,10 @@ struct svc_program nfsd_program = {
};
-u32 nfsd_supported_minorversion = 1;
+static bool nfsd_supported_minorversions[NFSD_SUPPORTED_MINOR_VERSION + 1] = {
+ [0] = 1,
+ [1] = 1,
+};
int nfsd_vers(int vers, enum vers_op change)
{
@@ -151,15 +154,13 @@ int nfsd_minorversion(u32 minorversion, enum vers_op change)
return -1;
switch(change) {
case NFSD_SET:
- nfsd_supported_minorversion = minorversion;
+ nfsd_supported_minorversions[minorversion] = true;
break;
case NFSD_CLEAR:
- if (minorversion == 0)
- return -1;
- nfsd_supported_minorversion = minorversion - 1;
+ nfsd_supported_minorversions[minorversion] = false;
break;
case NFSD_TEST:
- return minorversion <= nfsd_supported_minorversion;
+ return nfsd_supported_minorversions[minorversion];
case NFSD_AVAIL:
return minorversion <= NFSD_SUPPORTED_MINOR_VERSION;
}
--
1.7.9.5
^ permalink raw reply related [flat|nested] 3+ messages in thread* Re: [PATCH] nfsd4: fix minorversion support interface
2013-07-17 20:50 ` [PATCH] nfsd4: fix minorversion support interface J. Bruce Fields
@ 2013-07-17 21:08 ` J. Bruce Fields
0 siblings, 0 replies; 3+ messages in thread
From: J. Bruce Fields @ 2013-07-17 21:08 UTC (permalink / raw)
To: J. Bruce Fields; +Cc: Al Viro, linux-nfs, linux-fsdevel, jlayton, Dave Chinner
On Wed, Jul 17, 2013 at 04:50:01PM -0400, J. Bruce Fields wrote:
> From: "J. Bruce Fields" <bfields@redhat.com>
>
> You can turn on or off support for minorversions using e.g.
>
> echo "-4.2" >/proc/fs/nfsd/versions
>
> However, the current implementation is a little wonky. For example, the
> above will turn off 4.2 support, but it will also turn *on* 4.1 support.
Argh, sorry, I mistakenly fed an unrelated patch on the git-send-email
commandline: just ignore this one patch.
--b.
>
> This didn't matter as long as we only had 2 minorversions, which was
> true till very recently.
>
> And do a little cleanup here.
>
> Signed-off-by: J. Bruce Fields <bfields@redhat.com>
> ---
> fs/nfsd/nfs4proc.c | 2 +-
> fs/nfsd/nfsd.h | 1 -
> fs/nfsd/nfssvc.c | 13 +++++++------
> 3 files changed, 8 insertions(+), 8 deletions(-)
>
> diff --git a/fs/nfsd/nfs4proc.c b/fs/nfsd/nfs4proc.c
> index a7cee86..0d4c410 100644
> --- a/fs/nfsd/nfs4proc.c
> +++ b/fs/nfsd/nfs4proc.c
> @@ -1293,7 +1293,7 @@ nfsd4_proc_compound(struct svc_rqst *rqstp,
> * According to RFC3010, this takes precedence over all other errors.
> */
> status = nfserr_minor_vers_mismatch;
> - if (args->minorversion > nfsd_supported_minorversion)
> + if (nfsd_minorversion(args->minorversion, NFSD_TEST) <= 0)
> goto out;
>
> status = nfs41_check_op_ordering(args);
> diff --git a/fs/nfsd/nfsd.h b/fs/nfsd/nfsd.h
> index 2bbd94e..30f34ab 100644
> --- a/fs/nfsd/nfsd.h
> +++ b/fs/nfsd/nfsd.h
> @@ -53,7 +53,6 @@ struct readdir_cd {
> extern struct svc_program nfsd_program;
> extern struct svc_version nfsd_version2, nfsd_version3,
> nfsd_version4;
> -extern u32 nfsd_supported_minorversion;
> extern struct mutex nfsd_mutex;
> extern spinlock_t nfsd_drc_lock;
> extern unsigned long nfsd_drc_max_mem;
> diff --git a/fs/nfsd/nfssvc.c b/fs/nfsd/nfssvc.c
> index 6b9f48c..760c85a 100644
> --- a/fs/nfsd/nfssvc.c
> +++ b/fs/nfsd/nfssvc.c
> @@ -116,7 +116,10 @@ struct svc_program nfsd_program = {
>
> };
>
> -u32 nfsd_supported_minorversion = 1;
> +static bool nfsd_supported_minorversions[NFSD_SUPPORTED_MINOR_VERSION + 1] = {
> + [0] = 1,
> + [1] = 1,
> +};
>
> int nfsd_vers(int vers, enum vers_op change)
> {
> @@ -151,15 +154,13 @@ int nfsd_minorversion(u32 minorversion, enum vers_op change)
> return -1;
> switch(change) {
> case NFSD_SET:
> - nfsd_supported_minorversion = minorversion;
> + nfsd_supported_minorversions[minorversion] = true;
> break;
> case NFSD_CLEAR:
> - if (minorversion == 0)
> - return -1;
> - nfsd_supported_minorversion = minorversion - 1;
> + nfsd_supported_minorversions[minorversion] = false;
> break;
> case NFSD_TEST:
> - return minorversion <= nfsd_supported_minorversion;
> + return nfsd_supported_minorversions[minorversion];
> case NFSD_AVAIL:
> return minorversion <= NFSD_SUPPORTED_MINOR_VERSION;
> }
> --
> 1.7.9.5
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-nfs" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2013-07-17 21:08 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-07-12 21:40 [PATCH] nfsd4: fix minorversion support interface J. Bruce Fields
-- strict thread matches above, loose matches on Subject: below --
2013-07-17 20:50 [PATCH 00/16] Implement NFSv4 delegations, take 9 J. Bruce Fields
2013-07-17 20:50 ` [PATCH] nfsd4: fix minorversion support interface J. Bruce Fields
2013-07-17 21:08 ` 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).