Commit 5749ce92 authored by David Howells's avatar David Howells

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: e49c7b2f ("afs: Build an abstraction around an "operation" concept")
Reported-by: default avatarDave Botsch <botsch@cnf.cornell.edu>
Signed-off-by: default avatarDavid Howells <dhowells@redhat.com>
Tested-by: default avatarDave Botsch <botsch@cnf.cornell.edu>
parent 2ca068be
...@@ -71,7 +71,7 @@ static void afs_schedule_lock_extension(struct afs_vnode *vnode) ...@@ -71,7 +71,7 @@ static void afs_schedule_lock_extension(struct afs_vnode *vnode)
void afs_lock_op_done(struct afs_call *call) void afs_lock_op_done(struct afs_call *call)
{ {
struct afs_operation *op = call->op; struct afs_operation *op = call->op;
struct afs_vnode *vnode = op->lock.lvnode; struct afs_vnode *vnode = op->file[0].vnode;
if (call->error == 0) { if (call->error == 0) {
spin_lock(&vnode->lock); spin_lock(&vnode->lock);
......
...@@ -795,7 +795,6 @@ struct afs_operation { ...@@ -795,7 +795,6 @@ struct afs_operation {
struct afs_read *req; struct afs_read *req;
} fetch; } fetch;
struct { struct {
struct afs_vnode *lvnode; /* vnode being locked */
afs_lock_type_t type; afs_lock_type_t type;
} lock; } lock;
struct { struct {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment