Skip to contentSkip to conversation

nfsd: fix change_info in NFSv4 RENAME replies

PATCH Applied Jeff Layton 2 participants 4 messages Sep 9, 2023

Subsystems (2)
lore
Share & tools
lore

Jeff Layton

author maintainer
#0 lore raw

PATCH 1/1 nfsd: fix change_info in NFSv4 RENAME replies

nfsd sends the transposed directory change info in the RENAME reply. The source directory is in save_fh and the target is in current_fh.

---
This bug predates git, so I can't add a proper Fixes tag. I think this is probably appropriate for stable series kernels though.

This bug was largely papered over by the fact that we factored in the ctime when generating a change attribute. Since this commit, however:

638e3e7d9493 nfsd: use the getattr operation to fetch i_version

We stopped doing that for directory inodes and that caused this bug to pop up.

---
 fs/nfsd/nfs4proc.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
fs/nfsd/nfs4proc.c +2 -2
index 5ca748309c26..4199ede0583c 100644
@@ -1058,8 +1058,8 @@ nfsd4_rename(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,
 			     rename->rn_tname, rename->rn_tnamelen);
 	if (status)
 		return status;
-	set_change_info(&rename->rn_sinfo, &cstate->current_fh);
-	set_change_info(&rename->rn_tinfo, &cstate->save_fh);
+	set_change_info(&rename->rn_sinfo, &cstate->save_fh);
+	set_change_info(&rename->rn_tinfo, &cstate->current_fh);
 	return nfs_ok;
 }
 

---
base-commit: dd1386dd3c4f4bc55456c88180f9f39697bb95c0
change-id: 20230908-nfsd-fixes-f5bdb87e6035

Best regards,

Signature · 1 line
Jeff Layton <[email protected]>
Applied
#1 lore raw
Quoted 10 lines · Jeff Layton

nfsd sends the transposed directory change info in the RENAME reply. The source directory is in save_fh and the target is in current_fh.

---
This bug predates git, so I can't add a proper Fixes tag. I think this is probably appropriate for stable series kernels though.

Quoted 7 lines

This bug was largely papered over by the fact that we factored in the ctime when generating a change attribute. Since this commit, however:

638e3e7d9493 nfsd: use the getattr operation to fetch i_version

We stopped doing that for directory inodes and that caused this bug to pop up.

Applied to nfsd-fixes with a "Cc: stable" tag added.

Is there a publicly-accessible bug report link that can be included?

Quoted 28 lines
---
 fs/nfsd/nfs4proc.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
fs/nfsd/nfs4proc.c +2 -3
index 5ca748309c26..4199ede0583c 100644
@@ -1058,8 +1058,8 @@ nfsd4_rename(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,
 			     rename->rn_tname, rename->rn_tnamelen);
 	if (status)
 		return status;
-	set_change_info(&rename->rn_sinfo, &cstate->current_fh);
-	set_change_info(&rename->rn_tinfo, &cstate->save_fh);
+	set_change_info(&rename->rn_sinfo, &cstate->save_fh);
+	set_change_info(&rename->rn_tinfo, &cstate->current_fh);
 	return nfs_ok;
 }
 
 
---

base-commit: dd1386dd3c4f4bc55456c88180f9f39697bb95c0
change-id: 20230908-nfsd-fixes-f5bdb87e6035

Best regards,

Signature · 1 line
Jeff Layton <[email protected]>
Signature · 1 line
Chuck Lever
author maintainer
#2 lore raw
Quoted 14 lines · Chuck Lever
Quoted 13 lines · Jeff Layton

nfsd sends the transposed directory change info in the RENAME reply. The source directory is in save_fh and the target is in current_fh.

---
This bug predates git, so I can't add a proper Fixes tag. I think this is probably appropriate for stable series kernels though.

This bug was largely papered over by the fact that we factored in the ctime when generating a change attribute. Since this commit, however:

Quoted 10 lines
Quoted 4 lines

638e3e7d9493 nfsd: use the getattr operation to fetch i_version

We stopped doing that for directory inodes and that caused this bug to pop up.

Applied to nfsd-fixes with a "Cc: stable" tag added.

Is there a publicly-accessible bug report link that can be included?

Yes. I just made this one public:

    https://bugzilla.redhat.com/show_bug.cgi?id=2218844

It has Ben's reproducer script for this in it too.

Quoted 29 lines
Quoted 28 lines
---
 fs/nfsd/nfs4proc.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
fs/nfsd/nfs4proc.c +2 -3
index 5ca748309c26..4199ede0583c 100644
@@ -1058,8 +1058,8 @@ nfsd4_rename(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,
 			     rename->rn_tname, rename->rn_tnamelen);
 	if (status)
 		return status;
-	set_change_info(&rename->rn_sinfo, &cstate->current_fh);
-	set_change_info(&rename->rn_tinfo, &cstate->save_fh);
+	set_change_info(&rename->rn_sinfo, &cstate->save_fh);
+	set_change_info(&rename->rn_tinfo, &cstate->current_fh);
 	return nfs_ok;
 }
 
 
---

base-commit: dd1386dd3c4f4bc55456c88180f9f39697bb95c0
change-id: 20230908-nfsd-fixes-f5bdb87e6035

Best regards,

Signature · 1 line
Jeff Layton <[email protected]>
Signature · 1 line
Jeff Layton <[email protected]>
#3 lore raw
Quoted 30 lines · Jeff Layton
Quoted 14 lines · Chuck Lever
Quoted 13 lines · Jeff Layton

nfsd sends the transposed directory change info in the RENAME reply. The source directory is in save_fh and the target is in current_fh.

---
This bug predates git, so I can't add a proper Fixes tag. I think this is probably appropriate for stable series kernels though.

This bug was largely papered over by the fact that we factored in the ctime when generating a change attribute. Since this commit, however:

Quoted 10 lines
Quoted 4 lines

638e3e7d9493 nfsd: use the getattr operation to fetch i_version

We stopped doing that for directory inodes and that caused this bug to pop up.

Applied to nfsd-fixes with a "Cc: stable" tag added.

Is there a publicly-accessible bug report link that can be included?

Quoted 5 lines

Yes. I just made this one public:

   https://bugzilla.redhat.com/show_bug.cgi?id=2218844

It has Ben's reproducer script for this in it too.

Thanks, added in my private repo, to be pushed out later.

Quoted 24 lines
Quoted 24 lines
Quoted 24 lines

---
fs/nfsd/nfs4proc.c | 4 ++--

1 file changed, 2 insertions(+), 2 deletions(-)
fs/nfsd/nfs4proc.c +2 -3
index 5ca748309c26..4199ede0583c 100644
@@ -1058,8 +1058,8 @@ nfsd4_rename(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,
     rename->rn_tname, rename->rn_tnamelen);
 if (status)
 return status;
- set_change_info(&rename->rn_sinfo, &cstate->current_fh);
- set_change_info(&rename->rn_tinfo, &cstate->save_fh);
+ set_change_info(&rename->rn_sinfo, &cstate->save_fh);
+ set_change_info(&rename->rn_tinfo, &cstate->current_fh);
 return nfs_ok;
 }
 
 
---

base-commit: dd1386dd3c4f4bc55456c88180f9f39697bb95c0
change-id: 20230908-nfsd-fixes-f5bdb87e6035

Quoted 8 lines
Quoted 5 lines
Quoted 4 lines

Best regards,

Signature · 1 line
Jeff Layton <[email protected]>
Signature · 1 line
Jeff Layton <[email protected]>

--
Chuck Lever