* generic_setlease and tmpfs -- LTP fcntl failure
@ 2007-11-14 21:19 Kumar Gala
2007-11-14 22:50 ` J. Bruce Fields
0 siblings, 1 reply; 2+ messages in thread
From: Kumar Gala @ 2007-11-14 21:19 UTC (permalink / raw)
To: Linux Kernel Mailing List, Andrew Morton
In debugging a LTP failure related to fcntl on tmpfs it appears that
we aren't able to use fcntl(fd, F_SETLEASE, F_WRLCK). In the
debugging it looks like we artificial increase the dentry->d_count
and so generic_setlease() always fails with -EAGAIN since it appears
dentry->d_count will be 2.
This is my first time delving into fs code so I'm not that familiar
with why tmpfs is artificially increasing the d_count. I was
wondering what a possible solution would be.
Maybe something like:
shmem_setlease(...) {
if (arg == F_WRLCK) {
dput(dentry)
generic_setlease(...)
dget(dentry)
} else {
generic_setlease(...)
}
}
Not sure what harm doing the dput() / dget() will have.
- k
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: generic_setlease and tmpfs -- LTP fcntl failure
2007-11-14 21:19 generic_setlease and tmpfs -- LTP fcntl failure Kumar Gala
@ 2007-11-14 22:50 ` J. Bruce Fields
0 siblings, 0 replies; 2+ messages in thread
From: J. Bruce Fields @ 2007-11-14 22:50 UTC (permalink / raw)
To: Kumar Gala; +Cc: Linux Kernel Mailing List, Andrew Morton, richterd
On Wed, Nov 14, 2007 at 03:19:31PM -0600, Kumar Gala wrote:
> In debugging a LTP failure related to fcntl on tmpfs it appears that we
> aren't able to use fcntl(fd, F_SETLEASE, F_WRLCK). In the debugging it
> looks like we artificial increase the dentry->d_count and so
> generic_setlease() always fails with -EAGAIN since it appears
> dentry->d_count will be 2.
>
> This is my first time delving into fs code so I'm not that familiar with
> why tmpfs is artificially increasing the d_count. I was wondering what a
> possible solution would be.
>
> Maybe something like:
>
> shmem_setlease(...) {
> if (arg == F_WRLCK) {
> dput(dentry)
> generic_setlease(...)
> dget(dentry)
> } else {
> generic_setlease(...)
> }
> }
>
> Not sure what harm doing the dput() / dget() will have.
I guess if you *know* for whatever reason that you hold two references
on the dentry, then that might be safe.
I'd be happier if we could come up with some better way for the setlease
code to determine whether someone has the file open for writing. The
current tests seem incredibly fragile.
Would it be at all reasonable, for example, to keep a count of the
number of readers stored in the inode?
--b.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2007-11-14 22:51 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-11-14 21:19 generic_setlease and tmpfs -- LTP fcntl failure Kumar Gala
2007-11-14 22:50 ` J. Bruce Fields
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.