Skip to contentSkip to conversation

NFSv4.1: nfs4_opendata_check_deleg needs to handle NFS4_OPEN_CLAIM_DELEG_CUR_FH

PATCH Superseded Trond Myklebust 2 participants 3 messages Oct 2, 2015

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 NFSv4.1: nfs4_opendata_check_deleg needs to handle NFS4_OPEN_CLAIM_DELEG_CUR_FH

We need to warn against broken NFSv4.1 servers that try to hand out delegations in response to NFS4_OPEN_CLAIM_DELEG_CUR_FH.

---
 fs/nfs/nfs4proc.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)
fs/nfs/nfs4proc.c +6 -2
index f93b9cdb4934..56b0958b940f 100644
@@ -1458,12 +1458,16 @@ nfs4_opendata_check_deleg(struct nfs4_opendata *data, struct nfs4_state *state)
 	if (delegation)
 		delegation_flags = delegation->flags;
 	rcu_read_unlock();
-	if (data->o_arg.claim == NFS4_OPEN_CLAIM_DELEGATE_CUR) {
+	switch (data->o_arg.claim) {
+	case NFS4_OPEN_CLAIM_DELEGATE_CUR:
+	case NFS4_OPEN_CLAIM_DELEG_CUR_FH:
 		pr_err_ratelimited("NFS: Broken NFSv4 server %s is "
 				   "returning a delegation for "
 				   "OPEN(CLAIM_DELEGATE_CUR)\n",
 				   clp->cl_hostname);
-	} else if ((delegation_flags & 1UL<<NFS_DELEGATION_NEED_RECLAIM) == 0)
+		return;
+	}
+	if ((delegation_flags & 1UL<<NFS_DELEGATION_NEED_RECLAIM) == 0)
 		nfs_inode_set_delegation(state->inode,
 					 data->owner->so_cred,
 					 &data->o_res);
Signature · 1 line
2.4.3
#1 lore raw
config: m68k-sun3_defconfig (attached as .config) reproduce: wget https://git.kernel.org/cgit/linux/kernel/git/wfg/lkp-tests.git/plain/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross #…

Hi Trond,

[auto build test results on v4.3-rc3 -- if it's inappropriate base, please ignore]

config: m68k-sun3_defconfig (attached as .config)
reproduce:
wget https://git.kernel.org/cgit/linux/kernel/git/wfg/lkp-tests.git/plain/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross
# save the attached .config to linux build tree
make.cross ARCH=m68k

All warnings (new ones prefixed by >>):

fs/nfs/nfs4proc.c: In function 'nfs4_opendata_check_deleg':

>> fs/nfs/nfs4proc.c:1461:2: warning: enumeration value 'NFS4_OPEN_CLAIM_NULL' not handled in switch [-Wswitch]
     switch (data->o_arg.claim) {
     ^
>> fs/nfs/nfs4proc.c:1461:2: warning: enumeration value 'NFS4_OPEN_CLAIM_PREVIOUS' not handled in switch [-Wswitch]
>> fs/nfs/nfs4proc.c:1461:2: warning: enumeration value 'NFS4_OPEN_CLAIM_DELEGATE_PREV' not handled in switch [-Wswitch]
>> fs/nfs/nfs4proc.c:1461:2: warning: enumeration value 'NFS4_OPEN_CLAIM_FH' not handled in switch [-Wswitch]
>> fs/nfs/nfs4proc.c:1461:2: warning: enumeration value 'NFS4_OPEN_CLAIM_DELEG_PREV_FH' not handled in switch [-Wswitch]

vim +/NFS4_OPEN_CLAIM_NULL +1461 fs/nfs/nfs4proc.c

1445 atomic_inc(&state->count);
1446 return state;
1447 }
1448
1449 static void
1450 nfs4_opendata_check_deleg(struct nfs4_opendata *data, struct nfs4_state *state)
1451 {
1452 struct nfs_client *clp = NFS_SERVER(state->inode)->nfs_client;
1453 struct nfs_delegation *delegation;
1454 int delegation_flags = 0;
1455
1456 rcu_read_lock();
1457 delegation = rcu_dereference(NFS_I(state->inode)->delegation);
1458 if (delegation)
1459 delegation_flags = delegation->flags;
1460 rcu_read_unlock();

> 1461		switch (data->o_arg.claim) {
  1462		case NFS4_OPEN_CLAIM_DELEGATE_CUR:
  1463		case NFS4_OPEN_CLAIM_DELEG_CUR_FH:
  1464			pr_err_ratelimited("NFS: Broken NFSv4 server %s is "
  1465					   "returning a delegation for "
  1466					   "OPEN(CLAIM_DELEGATE_CUR)\n",
  1467					   clp->cl_hostname);

1468 return;
1469 }

---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation

#2 lore raw

PATCH v2 1/1 NFSv4.1: nfs4_opendata_check_deleg needs to handle NFS4_OPEN_CLAIM_DELEG_CUR_FH

We need to warn against broken NFSv4.1 servers that try to hand out delegations in response to NFS4_OPEN_CLAIM_DELEG_CUR_FH.

---
 fs/nfs/nfs4proc.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)
fs/nfs/nfs4proc.c +8 -2
index f93b9cdb4934..12e9808d5df0 100644
@@ -1458,12 +1458,18 @@ nfs4_opendata_check_deleg(struct nfs4_opendata *data, struct nfs4_state *state)
 	if (delegation)
 		delegation_flags = delegation->flags;
 	rcu_read_unlock();
-	if (data->o_arg.claim == NFS4_OPEN_CLAIM_DELEGATE_CUR) {
+	switch (data->o_arg.claim) {
+	default:
+		break;
+	case NFS4_OPEN_CLAIM_DELEGATE_CUR:
+	case NFS4_OPEN_CLAIM_DELEG_CUR_FH:
 		pr_err_ratelimited("NFS: Broken NFSv4 server %s is "
 				   "returning a delegation for "
 				   "OPEN(CLAIM_DELEGATE_CUR)\n",
 				   clp->cl_hostname);
-	} else if ((delegation_flags & 1UL<<NFS_DELEGATION_NEED_RECLAIM) == 0)
+		return;
+	}
+	if ((delegation_flags & 1UL<<NFS_DELEGATION_NEED_RECLAIM) == 0)
 		nfs_inode_set_delegation(state->inode,
 					 data->owner->so_cred,
 					 &data->o_res);
Signature · 1 line
2.4.3