Re: [PATCH] knfsd: check for existence of file_lock parameter inside of the kernel lock.

From: Matthew Wilcox
Date: Thu Jan 06 2005 - 23:22:19 EST


On Wed, Jan 05, 2005 at 05:48:59AM +0000, Linux Kernel Mailing List wrote:
> ChangeSet 1.2177, 2005/01/04 21:48:59-08:00, neilb@xxxxxxxxxxxxxxx
>
> [PATCH] knfsd: check for existence of file_lock parameter inside of the kernel lock.

Why? What is lock_kernel() protecting here?

> Signed-off-by: Andy Adamson <andros@xxxxxxxxxxxxxx>
> Signed-off-by: Neil Brown <neilb@xxxxxxxxxxxxxxx>
> Signed-off-by: Andrew Morton <akpm@xxxxxxxx>
> Signed-off-by: Linus Torvalds <torvalds@xxxxxxxx>
>
>
>
> locks.c | 8 +++-----
> 1 files changed, 3 insertions(+), 5 deletions(-)
>
>
> diff -Nru a/fs/locks.c b/fs/locks.c
> --- a/fs/locks.c 2005-01-04 23:42:28 -08:00
> +++ b/fs/locks.c 2005-01-04 23:42:28 -08:00
> @@ -1096,15 +1096,13 @@
> */
> void remove_lease(struct file_lock *fl)
> {
> - if (!IS_LEASE(fl))
> - return;
> -
> lock_kernel();
> -
> + if (!fl || !IS_LEASE(fl))
> + goto out;
> fl->fl_type = F_UNLCK | F_INPROGRESS;
> fl->fl_break_time = jiffies - 10;
> time_out_leases(fl->fl_file->f_dentry->d_inode);
> -
> +out:
> unlock_kernel();
> }
>
> -
> To unsubscribe from this list: send the line "unsubscribe bk-commits-head" in
> the body of a message to majordomo@xxxxxxxxxxxxxxx
> More majordomo info at http://vger.kernel.org/majordomo-info.html

--
"Next the statesmen will invent cheap lies, putting the blame upon
the nation that is attacked, and every man will be glad of those
conscience-soothing falsities, and will diligently study them, and refuse
to examine any refutations of them; and thus he will by and by convince
himself that the war is just, and will thank God for the better sleep
he enjoys after this process of grotesque self-deception." -- Mark Twain
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/