From bc9a8c4a446e1c177b58db3f2fce1b53c8e77a73 Mon Sep 17 00:00:00 2001 From: "J. Bruce Fields" Date: Wed, 3 Nov 2010 16:49:44 -0400 Subject: [PATCH] --- yaml --- r: 221745 b: refs/heads/master c: 3df057ac9afe83c4af84016df3baf3a0eb1d3d33 h: refs/heads/master i: 221743: 7da4d6677f0d234c46b90fe563e5a0a048778f85 v: v3 --- [refs] | 2 +- trunk/fs/locks.c | 7 +++++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/[refs] b/[refs] index 5db428da756f..ba6c60503a22 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: 21b75b019983dfa5c2dda588f4b60b4ca69844a4 +refs/heads/master: 3df057ac9afe83c4af84016df3baf3a0eb1d3d33 diff --git a/trunk/fs/locks.c b/trunk/fs/locks.c index 65765cb6afed..61c22f722050 100644 --- a/trunk/fs/locks.c +++ b/trunk/fs/locks.c @@ -1504,7 +1504,7 @@ static int do_fcntl_delete_lease(struct file *filp) static int do_fcntl_add_lease(unsigned int fd, struct file *filp, long arg) { - struct file_lock *fl; + struct file_lock *fl, *ret; struct fasync_struct *new; struct inode *inode = filp->f_path.dentry->d_inode; int error; @@ -1518,6 +1518,7 @@ static int do_fcntl_add_lease(unsigned int fd, struct file *filp, long arg) locks_free_lock(fl); return -ENOMEM; } + ret = fl; lock_flocks(); error = __vfs_setlease(filp, arg, &fl); if (error) { @@ -1525,6 +1526,8 @@ static int do_fcntl_add_lease(unsigned int fd, struct file *filp, long arg) locks_free_lock(fl); goto out_free_fasync; } + if (ret != fl) + locks_free_lock(fl); /* * fasync_insert_entry() returns the old entry if any. @@ -1532,7 +1535,7 @@ static int do_fcntl_add_lease(unsigned int fd, struct file *filp, long arg) * inserted it into the fasync list. Clear new so that * we don't release it here. */ - if (!fasync_insert_entry(fd, filp, &fl->fl_fasync, new)) + if (!fasync_insert_entry(fd, filp, &ret->fl_fasync, new)) new = NULL; if (error < 0) {