summaryrefslogtreecommitdiffstats
path: root/fs/afs/dir.c
diff options
context:
space:
mode:
authorDavid Howells <dhowells@redhat.com>2019-06-20 19:12:16 +0200
committerDavid Howells <dhowells@redhat.com>2019-06-20 19:12:16 +0200
commitfa59f52f5b1412c373813e24e7cbe5ab44518ed8 (patch)
tree5d6226d6d4fbb25e202e391a9d722cdf5c41dcaa /fs/afs/dir.c
parentafs: Fix setting of i_blocks (diff)
downloadlinux-fa59f52f5b1412c373813e24e7cbe5ab44518ed8.tar.xz
linux-fa59f52f5b1412c373813e24e7cbe5ab44518ed8.zip
afs: afs_unlink() doesn't need to check dentry->d_inode
Don't check that dentry->d_inode is valid in afs_unlink(). We should be able to take that as given. This caused Smatch to issue the following warning: fs/afs/dir.c:1392 afs_unlink() error: we previously assumed 'vnode' could be null (see line 1375) Reported-by: kbuild test robot <lkp@intel.com> Reported-by: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: David Howells <dhowells@redhat.com>
Diffstat (limited to 'fs/afs/dir.c')
-rw-r--r--fs/afs/dir.c14
1 files changed, 6 insertions, 8 deletions
diff --git a/fs/afs/dir.c b/fs/afs/dir.c
index 79d93a26759a..93fd51c3bdae 100644
--- a/fs/afs/dir.c
+++ b/fs/afs/dir.c
@@ -1394,7 +1394,8 @@ static int afs_unlink(struct inode *dir, struct dentry *dentry)
{
struct afs_fs_cursor fc;
struct afs_status_cb *scb;
- struct afs_vnode *dvnode = AFS_FS_I(dir), *vnode = NULL;
+ struct afs_vnode *dvnode = AFS_FS_I(dir);
+ struct afs_vnode *vnode = AFS_FS_I(d_inode(dentry));
struct key *key;
bool need_rehash = false;
int ret;
@@ -1417,15 +1418,12 @@ static int afs_unlink(struct inode *dir, struct dentry *dentry)
}
/* Try to make sure we have a callback promise on the victim. */
- if (d_really_is_positive(dentry)) {
- vnode = AFS_FS_I(d_inode(dentry));
- ret = afs_validate(vnode, key);
- if (ret < 0)
- goto error_key;
- }
+ ret = afs_validate(vnode, key);
+ if (ret < 0)
+ goto error_key;
spin_lock(&dentry->d_lock);
- if (vnode && d_count(dentry) > 1) {
+ if (d_count(dentry) > 1) {
spin_unlock(&dentry->d_lock);
/* Start asynchronous writeout of the inode */
write_inode_now(d_inode(dentry), 0);