Re: [PATCH] fs/locks.c fcntl_setlease did not check if a file was opened for writing before granting a read lease

From: Jamie Lokier
Date: Tue Dec 02 2003 - 21:11:33 EST


Sean Neakums wrote:
> > if ((arg == F_RDLCK)
> > && ((atomic_read(&inode->i_writer_count) != 0)))
> >
> > You'll also need to modify all the places where that needs to be
> > maintained.
>
> Looking at 2.6.0-test11, it seems that its struct inode has such a
> field, albeit named i_writecount. Commentary from fs/namei.c:

Cool. At a glance, it looks like deny_write_access() can be used to
handle the F_RDLCK case.

(It would also be nice to have some way of blocking until the lease can
be taken, but even the F_WRLCK case doesn't offer that at the moment).

-- Jamie
-
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/