cifsd: remove useless error handling in ksmbd_vfs_read
authorHyunchul Lee <hyc.lee@gmail.com>
Thu, 1 Apr 2021 08:47:19 +0000 (17:47 +0900)
committerSteve French <stfrench@microsoft.com>
Tue, 11 May 2021 00:15:34 +0000 (19:15 -0500)
dentry->d_inode never happen to be NULL if we hold the dentry.

Signed-off-by: Hyunchul Lee <hyc.lee@gmail.com>
Signed-off-by: Namjae Jeon <namjae.jeon@samsung.com>
Signed-off-by: Steve French <stfrench@microsoft.com>
fs/cifsd/vfs.c

index 6313d5c..ef82367 100644 (file)
@@ -550,7 +550,7 @@ int ksmbd_vfs_fsync(struct ksmbd_work *work, u64 fid, u64 p_id)
 int ksmbd_vfs_remove_file(struct ksmbd_work *work, char *name)
 {
        struct path parent;
-       struct dentry *dir, *dentry;
+       struct dentry *dentry;
        char *last;
        int err;
 
@@ -569,12 +569,8 @@ int ksmbd_vfs_remove_file(struct ksmbd_work *work, char *name)
                return err;
        }
 
-       dir = parent.dentry;
-       if (!d_inode(dir))
-               goto out;
-
-       inode_lock_nested(d_inode(dir), I_MUTEX_PARENT);
-       dentry = lookup_one_len(last, dir, strlen(last));
+       inode_lock_nested(d_inode(parent.dentry), I_MUTEX_PARENT);
+       dentry = lookup_one_len(last, parent.dentry, strlen(last));
        if (IS_ERR(dentry)) {
                err = PTR_ERR(dentry);
                ksmbd_debug(VFS, "%s: lookup failed, err %d\n", last, err);
@@ -588,12 +584,12 @@ int ksmbd_vfs_remove_file(struct ksmbd_work *work, char *name)
        }
 
        if (S_ISDIR(d_inode(dentry)->i_mode)) {
-               err = vfs_rmdir(&init_user_ns, d_inode(dir), dentry);
+               err = vfs_rmdir(&init_user_ns, d_inode(parent.dentry), dentry);
                if (err && err != -ENOTEMPTY)
                        ksmbd_debug(VFS, "%s: rmdir failed, err %d\n", name,
                                err);
        } else {
-               err = vfs_unlink(&init_user_ns, d_inode(dir), dentry, NULL);
+               err = vfs_unlink(&init_user_ns, d_inode(parent.dentry), dentry, NULL);
                if (err)
                        ksmbd_debug(VFS, "%s: unlink failed, err %d\n", name,
                                err);
@@ -601,8 +597,7 @@ int ksmbd_vfs_remove_file(struct ksmbd_work *work, char *name)
 
        dput(dentry);
 out_err:
-       inode_unlock(d_inode(dir));
-out:
+       inode_unlock(d_inode(parent.dentry));
        rollback_path_modification(last);
        path_put(&parent);
        ksmbd_revert_fsids(work);