aboutsummaryrefslogtreecommitdiffstats
path: root/fs/afs/inode.c
diff options
context:
space:
mode:
authorDavid Howells <dhowells@redhat.com>2019-05-14 12:29:11 +0100
committerDavid Howells <dhowells@redhat.com>2019-05-16 22:23:21 +0100
commita38a75581e6e2f783e7b8658e9ca5d4243279f55 (patch)
tree4df2ddb097f5301ee92e8fe9ba2541b0dd40d9e4 /fs/afs/inode.c
parentafs: Clear AFS_VNODE_CB_PROMISED if we detect callback expiry (diff)
downloadlinux-dev-a38a75581e6e2f783e7b8658e9ca5d4243279f55.tar.xz
linux-dev-a38a75581e6e2f783e7b8658e9ca5d4243279f55.zip
afs: Fix unlink to handle YFS.RemoveFile2 better
Make use of the status update for the target file that the YFS.RemoveFile2 RPC op returns to correctly update the vnode as to whether the file was actually deleted or just had nlink reduced. Fixes: 30062bd13e36 ("afs: Implement YFS support in the fs client") Signed-off-by: David Howells <dhowells@redhat.com>
Diffstat (limited to 'fs/afs/inode.c')
-rw-r--r--fs/afs/inode.c18
1 files changed, 14 insertions, 4 deletions
diff --git a/fs/afs/inode.c b/fs/afs/inode.c
index 37c5de793353..e1a523d2e378 100644
--- a/fs/afs/inode.c
+++ b/fs/afs/inode.c
@@ -23,6 +23,7 @@
#include <linux/namei.h>
#include <linux/iversion.h>
#include "internal.h"
+#include "afs_fs.h"
static const struct inode_operations afs_symlink_inode_operations = {
.get_link = page_get_link,
@@ -271,13 +272,22 @@ void afs_vnode_commit_status(struct afs_fs_cursor *fc,
write_seqlock(&vnode->cb_lock);
- afs_apply_status(fc, vnode, scb, expected_version);
- if (scb->have_cb)
- afs_apply_callback(fc, vnode, scb, cb_break);
+ if (scb->have_error) {
+ if (scb->status.abort_code == VNOVNODE) {
+ set_bit(AFS_VNODE_DELETED, &vnode->flags);
+ clear_nlink(&vnode->vfs_inode);
+ __afs_break_callback(vnode);
+ }
+ } else {
+ if (scb->have_status)
+ afs_apply_status(fc, vnode, scb, expected_version);
+ if (scb->have_cb)
+ afs_apply_callback(fc, vnode, scb, cb_break);
+ }
write_sequnlock(&vnode->cb_lock);
- if (fc->ac.error == 0)
+ if (fc->ac.error == 0 && scb->have_status)
afs_cache_permit(vnode, fc->key, cb_break, scb);
}