nfsd: Fix error cleanup path in nfsd_rename()
Subsystems (2)
PATCH 1/1 nfsd: Fix error cleanup path in nfsd_rename()
Commit a8b0026847b8 ("rename(): avoid a deadlock in the case of parents having no common ancestor") added an error bail out path. However this path does not drop the remount protection that has been acquired. Fix the cleanup path to properly drop the remount protection.
--- fs/nfsd/vfs.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
fs/nfsd/vfs.c +2 -1
@@ -1852,7 +1852,7 @@ nfsd_rename(struct svc_rqst *rqstp, struct svc_fh *ffhp, char *fname, int flen, trap =lock_rename (tdentry, fdentry);if (IS_ERR (trap)) { err = (rqstp->rq_vers ==2 ) ? nfserr_acces : nfserr_xdev; - goto out; + goto out_want_write; } err =fh_fill_pre_attrs (ffhp);if (err != nfs_ok)
@@ -1922,6 +1922,7 @@ nfsd_rename(struct svc_rqst *rqstp, struct svc_fh *ffhp, char *fname, int flen, } out_unlock:unlock_rename (tdentry, fdentry); +out_want_write:fh_drop_write (ffhp);/*
Signature · 1 line
2.35.3
Quoted 25 lines · Jan Kara
Commit
a8b0026847b8("rename(): avoid a deadlock in the case of parents having no common ancestor") added an error bail out path. However this path does not drop the remount protection that has been acquired. Fix the cleanup path to properly drop the remount protection.Fixes a8b0026847b8 ("rename(): avoid a deadlock in the case of parents having no common ancestor")Signed-off-by Jan Kara <[email protected]>--- fs/nfsd/vfs.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)fs/nfsd/vfs.c +1
-1@@ -1852,7 +1852,7 @@ nfsd_rename(struct svc_rqst *rqstp, struct svc_fh *ffhp, char *fname, int flen, trap =lock_rename (tdentry, fdentry);if (IS_ERR (trap)) { err = (rqstp->rq_vers ==2 ) ? nfserr_acces : nfserr_xdev; - goto out; + goto out_want_write; } err =fh_fill_pre_attrs (ffhp);if (err != nfs_ok)
fs/nfsd/vfs.c nfsd_rename(struct svc_rqst *rqstp, struct svc_fh *ffhp, char *fname, int flen, · line 1928
Quoted 7 lines
fs/nfsd/vfs.c +1
-0@@ -1922,6 +1922,7 @@ nfsd_rename(struct svc_rqst *rqstp, struct svc_fh *ffhp, char *fname, int flen, } out_unlock:unlock_rename (tdentry, fdentry); +out_want_write:fh_drop_write (ffhp);/*
Nice catch.
Quoted 7 lines · Jan Kara
Commit
a8b0026847b8("rename(): avoid a deadlock in the case of parents having no common ancestor") added an error bail out path. However this path does not drop the remount protection that has been acquired. Fix the cleanup path to properly drop the remount protection.Fixes a8b0026847b8 ("rename(): avoid a deadlock in the case of parents having no common ancestor")Signed-off-by Jan Kara <[email protected]>
Al, Jan, let me know if you'd like me to take this through the nfsd tree for v6.9-rc. If not:
Quoted 28 lines
--- fs/nfsd/vfs.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)fs/nfsd/vfs.c +2
-1@@ -1852,7 +1852,7 @@ nfsd_rename(struct svc_rqst *rqstp, struct svc_fh *ffhp, char *fname, int flen, trap =lock_rename (tdentry, fdentry);if (IS_ERR (trap)) { err = (rqstp->rq_vers ==2 ) ? nfserr_acces : nfserr_xdev; - goto out; + goto out_want_write; } err =fh_fill_pre_attrs (ffhp);if (err != nfs_ok)@@ -1922,6 +1922,7 @@ nfsd_rename(struct svc_rqst *rqstp, struct svc_fh *ffhp, char *fname, int flen, } out_unlock:unlock_rename (tdentry, fdentry); +out_want_write:fh_drop_write (ffhp);/* Signature · 1 line
2.35.3
Signature · 1 line
Chuck Lever
Quoted 6 lines · Chuck Lever
Quoted 5 lines · Jan Kara
Commit
a8b0026847b8("rename(): avoid a deadlock in the case of parents having no common ancestor") added an error bail out path. However this path does not drop the remount protection that has been acquired. Fix the cleanup path to properly drop the remount protection.
Quoted 7 lines
Quoted 2 lines
Fixes a8b0026847b8 ("rename(): avoid a deadlock in the case of parents having no common ancestor")Signed-off-by Jan Kara <[email protected]>Al, Jan, let me know if you'd like me to take this through the nfsd tree for v6.9-rc. If not:
Acked-by Chuck Lever <[email protected]>
Yeah, I guess taking this through NFS tree is the best.
Honza
Quoted 34 lines
Quoted 30 lines
--- fs/nfsd/vfs.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)fs/nfsd/vfs.c +2
-1@@ -1852,7 +1852,7 @@ nfsd_rename(struct svc_rqst *rqstp, struct svc_fh *ffhp, char *fname, int flen, trap =lock_rename (tdentry, fdentry);if (IS_ERR (trap)) { err = (rqstp->rq_vers ==2 ) ? nfserr_acces : nfserr_xdev; - goto out; + goto out_want_write; } err =fh_fill_pre_attrs (ffhp);if (err != nfs_ok)@@ -1922,6 +1922,7 @@ nfsd_rename(struct svc_rqst *rqstp, struct svc_fh *ffhp, char *fname, int flen, } out_unlock:unlock_rename (tdentry, fdentry); +out_want_write:fh_drop_write (ffhp);/* Signature · 1 line
2.35.3Signature · 1 line
Chuck Lever
Signature · 2 lines
Jan Kara <[email protected]> SUSE Labs, CR
Quoted 10 lines · Jan Kara
Quoted 9 lines · Chuck Lever
Quoted 7 lines · Jan Kara
Commit
a8b0026847b8("rename(): avoid a deadlock in the case of parents having no common ancestor") added an error bail out path. However this path does not drop the remount protection that has been acquired. Fix the cleanup path to properly drop the remount protection.Fixes a8b0026847b8 ("rename(): avoid a deadlock in the case of parents having no common ancestor")Signed-off-by Jan Kara <[email protected]>
Quoted 6 lines
Quoted 4 lines
Al, Jan, let me know if you'd like me to take this through the nfsd tree for v6.9-rc. If not:
Acked-by Chuck Lever <[email protected]>Yeah, I guess taking this through NFS tree is the best.
I've pushed this to my nfsd-fixes branch, and will begin testing.
Quoted 39 lines
Honza
Quoted 34 lines
Quoted 30 lines
--- fs/nfsd/vfs.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)fs/nfsd/vfs.c +2
-1@@ -1852,7 +1852,7 @@ nfsd_rename(struct svc_rqst *rqstp, struct svc_fh *ffhp, char *fname, int flen, trap =lock_rename (tdentry, fdentry);if (IS_ERR (trap)) { err = (rqstp->rq_vers ==2 ) ? nfserr_acces : nfserr_xdev; - goto out; + goto out_want_write; } err =fh_fill_pre_attrs (ffhp);if (err != nfs_ok)@@ -1922,6 +1922,7 @@ nfsd_rename(struct svc_rqst *rqstp, struct svc_fh *ffhp, char *fname, int flen, } out_unlock:unlock_rename (tdentry, fdentry); +out_want_write:fh_drop_write (ffhp);/* Signature · 1 line
2.35.3Signature · 1 line
Chuck LeverSignature · 2 lines
Jan Kara <[email protected]> SUSE Labs, CR
Signature · 1 line
Chuck Lever
Quoted 7 lines · Jan Kara
Commit
a8b0026847b8("rename(): avoid a deadlock in the case of parents having no common ancestor") added an error bail out path. However this path does not drop the remount protection that has been acquired. Fix the cleanup path to properly drop the remount protection.Fixes a8b0026847b8 ("rename(): avoid a deadlock in the case of parents having no common ancestor")Signed-off-by Jan Kara <[email protected]>
Sorry, my fault.