Re: [PATCH] 2.5: push BKL out of llseek

Robert Love (rml@tech9.net)
29 Jan 2002 19:41:48 -0500


On Tue, 2002-01-29 at 19:09, Linus Torvalds wrote:

> Thinking about that, that actally sounds like the _right_ thing to do even
> from a correctness standpoint - as llseek() looks at the inode size, so we
> should have that lock anyway.
>
> So I'd suggest doing the inode semaphore globally, instead of using
> kernel_lock at all.

This was my end result (or some sort of proper finer-grained lock) but I
was unsure of how to deal with the other llseek methods that may be
oddball. I have no reason to suspect using the inode semaphore won't
work.

Another gain from pushing the locks into each method is that we can pick
and choose as-needed. If it turns out inode semaphore is a global
solution, the following patch is sufficient. Otherwise, we could
replace the lock_kernel in each caller with the inode semaphore, as
appropriate. Oh Al ??

Robert Love

--- linux-2.5.3-pre6/fs/read_write.c Mon Jan 28 18:30:22 2002
+++ linux/fs/read_write.c Tue Jan 29 19:29:32 2002
@@ -84,9 +84,9 @@
fn = default_llseek;
if (file->f_op && file->f_op->llseek)
fn = file->f_op->llseek;
- lock_kernel();
+ down(&file->f_dentry->d_inode->i_sem);
retval = fn(file, offset, origin);
- unlock_kernel();
+ up(&file->f_dentry->d_inode->i_sem);
return retval;
}

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/