All of lore.kernel.org
 help / color / mirror / Atom feed
From: "J. Bruce Fields" <bfields@fieldses.org>
To: Kumar Gala <galak@kernel.crashing.org>
Cc: Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	Andrew Morton <akpm@linux-foundation.org>,
	richterd@citi.umich.edu
Subject: Re: generic_setlease and tmpfs -- LTP fcntl failure
Date: Wed, 14 Nov 2007 17:50:50 -0500	[thread overview]
Message-ID: <20071114225050.GA14772@fieldses.org> (raw)
In-Reply-To: <4DACDAEF-A2B4-438D-A330-85FD5E65E3DE@kernel.crashing.org>

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.

      reply	other threads:[~2007-11-14 22:51 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-11-14 21:19 generic_setlease and tmpfs -- LTP fcntl failure Kumar Gala
2007-11-14 22:50 ` J. Bruce Fields [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20071114225050.GA14772@fieldses.org \
    --to=bfields@fieldses.org \
    --cc=akpm@linux-foundation.org \
    --cc=galak@kernel.crashing.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=richterd@citi.umich.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.