Message ID | 20220707045112.10177-3-xiubli@redhat.com |
---|---|
State | New |
Headers | show |
Series | netfs: fix the crash when unlocking the folio | expand |
diff --git a/fs/afs/file.c b/fs/afs/file.c index afacce797fb9..b23e7b5a48ad 100644 --- a/fs/afs/file.c +++ b/fs/afs/file.c @@ -379,7 +379,13 @@ static int afs_check_write_begin(struct file *file, loff_t pos, unsigned len, { struct afs_vnode *vnode = AFS_FS_I(file_inode(file)); - return test_bit(AFS_VNODE_DELETED, &vnode->flags) ? -ESTALE : 0; + if (test_bit(AFS_VNODE_DELETED, &vnode->flags)) { + folio_unlock(*folio); + folio_put(*folio); + return -ESTALE; + } + + return 0; } static void afs_free_request(struct netfs_io_request *rreq)