ovl: clarify dget/dput in ovl_cleanup()
Subsystems (2)
PATCH 1/1 ovl: clarify dget/dput in ovl_cleanup()
Add a comment explaining the reason for the seemingly pointless extra reference.
--- fs/overlayfs/dir.c | 4 ++++ 1 file changed, 4 insertions(+)
fs/overlayfs/dir.c +4 -0
@@ -28,6 +28,10 @@ int ovl_cleanup(struct ovl_fs *ofs, struct inode *wdir, struct dentry *wdentry) {int err; +/* +* Cached negative upper dentries are generally not useful, so grab a +* ref to the victim to keep it from turning negative. +*/ dget (wdentry);if (d_is_dir (wdentry)) err =ovl_do_rmdir (ofs, wdir, wdentry);
Signature · 1 line
2.47.0
Miklos Szeredi
maintainerQuoted 15 lines · Miklos Szeredi
Add a comment explaining the reason for the seemingly pointless extra reference.
Suggested-by Al Viro <[email protected]>Signed-off-by Miklos Szeredi <[email protected]>--- fs/overlayfs/dir.c | 4 ++++ 1 file changed, 4 insertions(+)fs/overlayfs/dir.c +0
-0
fs/overlayfs/dir.c int ovl_cleanup(struct ovl_fs *ofs, struct inode *wdir, struct dentry *wdentry) · line 34
Quoted 7 lines
fs/overlayfs/dir.c +4
-0@@ -28,6 +28,10 @@ int ovl_cleanup(struct ovl_fs *ofs, struct inode *wdir, struct dentry *wdentry) {int err; +/* +* Cached negative upper dentries are generally not useful, so grab a +* ref to the victim to keep it from turning negative. +*/
In fact an explicit d_drop() after the fact would have exactly the same effect, so maybe that would be cleaner...
Thanks,
Miklos
Amir Goldstein
maintainerQuoted 20 lines · Miklos Szeredi
Quoted 18 lines · Miklos Szeredi
Add a comment explaining the reason for the seemingly pointless extra reference.
Suggested-by Al Viro <[email protected]>Signed-off-by Miklos Szeredi <[email protected]>--- fs/overlayfs/dir.c | 4 ++++ 1 file changed, 4 insertions(+)fs/overlayfs/dir.c +0
-0@@ -28,6 +28,10 @@ int ovl_cleanup(struct ovl_fs *ofs, struct inode *wdir, struct dentry *wdentry) {int err;
Quoted 8 lines
fs/overlayfs/dir.c int ovl_cleanup(struct ovl_fs *ofs, struct inode *wdir, struct dentry *wdentry) · line 34
Quoted 4 lines
fs/overlayfs/dir.c +4
-0+/* +* Cached negative upper dentries are generally not useful, so grab a +* ref to the victim to keep it from turning negative. +*/ In fact an explicit
d_drop()after the fact would have exactly the same effect, so maybe that would be cleaner...
Agree.
Thanks,
Amir.