Skip to content

Commit 5749ce9

Browse files
committed
afs: Fix file locking
Fix AFS file locking to use the correct vnode pointer and remove a member of the afs_operation struct that is never set, but it is read and followed, causing an oops. This can be triggered by: flock -s /afs/example.com/foo sleep 1 when it calls the kernel to get a file lock. Fixes: e49c7b2 ("afs: Build an abstraction around an "operation" concept") Reported-by: Dave Botsch <[email protected]> Signed-off-by: David Howells <[email protected]> Tested-by: Dave Botsch <[email protected]>
1 parent 2ca068b commit 5749ce9

File tree

2 files changed

+1
-2
lines changed

2 files changed

+1
-2
lines changed

fs/afs/flock.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ static void afs_schedule_lock_extension(struct afs_vnode *vnode)
7171
void afs_lock_op_done(struct afs_call *call)
7272
{
7373
struct afs_operation *op = call->op;
74-
struct afs_vnode *vnode = op->lock.lvnode;
74+
struct afs_vnode *vnode = op->file[0].vnode;
7575

7676
if (call->error == 0) {
7777
spin_lock(&vnode->lock);

fs/afs/internal.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -795,7 +795,6 @@ struct afs_operation {
795795
struct afs_read *req;
796796
} fetch;
797797
struct {
798-
struct afs_vnode *lvnode; /* vnode being locked */
799798
afs_lock_type_t type;
800799
} lock;
801800
struct {

0 commit comments

Comments
 (0)