All of lore.kernel.org
 help / color / mirror / Atom feed
From: Bernd Schubert <bernd.schubert@itwm.fraunhofer.de>
To: Christoph Hellwig <hch@infradead.org>
Cc: linux-nfs@vger.kernel.org, linux-ext4@vger.kernel.org,
	linux-fsdevel@vger.kernel.org, yong.fan@whamcloud.com,
	adilger@whamcloud.com, tytso@mit.edu
Subject: Re: [PATCH 3/3] nfsd: vfs_llseek() with O_32BITHASH or O_64BITHASH
Date: Thu, 28 Jul 2011 11:19:07 +0200	[thread overview]
Message-ID: <4E31298B.7050800@itwm.fraunhofer.de> (raw)
In-Reply-To: <20110727210344.GC9066@infradead.org>

On 07/27/2011 11:03 PM, Christoph Hellwig wrote:
> On Wed, Jul 27, 2011 at 01:02:59PM +0200, Bernd Schubert wrote:
>> Use 32-bit or 64-bit llseek() hashes for directory offsets depending on
>> the NFS version. NFSv2 gets 32-bit hashes only.
>
> Independent of the O_ vs FMODE thing make sure you pass the correct
> flag at open time, instead of racy runtime modifications.
>

Christoph,

before I'm going to work further on the patch sets, I have few questions 
first. Could you please help me with that?

file->f_mode is set in __dentry_open() based on O_ flags.

So if f_mode is supposed to be set directly during the NFS open call we 
would need O_ *and* FMODE flags,

Now I still do not understand why we cannot add a flag *after* the open 
call and only in nfsd_readdir()? I do not see any races there.

nfsd_readdir() gets its 'struct file' from get_empty_filp() and 
__dentry_open(). Now as 'struct file' is allocated by get_empty_filp() 
it also cannot be used by any other thread.

nfsd_readdir() just reads the directory and closes it immedeatily after 
the readdir().

So where is there supposed to be a race?


And lastly, if we are going to set f_mode directly at open time, we have 
the choice to

1) Specify those new O_ flags for all files. While setting a flag is a 
cheap operation, it still wastes CPU cycles for file opens, as files do 
not need that flag.

2) Duplicate nfsd_open() to implement a new function for directories 
only. I think not a good idea either.

3) Rewrite the nfsd_open() function to allow to set flags from calling 
functions. That would mean to update the nfsd code at at least 8 places. 
Do we really want to go that way?


So altogether, updating the patches to replace O_ by FMODE flags is 
easy, but setting that flag in nfsd at open time, would mean a large 
overhead.


Thanks,
Bernd


  reply	other threads:[~2011-07-28  9:19 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-07-27 11:02 [PATCH 0/3] 32/64 bit llseek hashes Bernd Schubert
     [not found] ` <20110727110148.204979.49551.stgit-bi+AKbBUZKY6gyzm1THtWbp2dZbC/Bob@public.gmane.org>
2011-07-27 11:02   ` [PATCH 1/3] Return 32/64-bit dir name hash according to usage type Bernd Schubert
2011-07-27 11:02     ` Bernd Schubert
     [not found]     ` <20110727110249.204979.58769.stgit-bi+AKbBUZKY6gyzm1THtWbp2dZbC/Bob@public.gmane.org>
2011-07-27 21:02       ` Christoph Hellwig
2011-07-27 21:02         ` Christoph Hellwig
2011-07-28 20:04     ` Bernd Schubert
2011-07-27 11:02   ` [PATCH 2/3] Remove check for a 32-bit cookie in nfsd4_readdir() Bernd Schubert
2011-07-27 11:02     ` Bernd Schubert
2011-07-27 11:02 ` [PATCH 3/3] nfsd: vfs_llseek() with O_32BITHASH or O_64BITHASH Bernd Schubert
     [not found]   ` <20110727110259.204979.56782.stgit-bi+AKbBUZKY6gyzm1THtWbp2dZbC/Bob@public.gmane.org>
2011-07-27 21:03     ` Christoph Hellwig
2011-07-27 21:03       ` Christoph Hellwig
2011-07-28  9:19       ` Bernd Schubert [this message]
2011-07-28 11:46         ` Christoph Hellwig

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=4E31298B.7050800@itwm.fraunhofer.de \
    --to=bernd.schubert@itwm.fraunhofer.de \
    --cc=adilger@whamcloud.com \
    --cc=hch@infradead.org \
    --cc=linux-ext4@vger.kernel.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-nfs@vger.kernel.org \
    --cc=tytso@mit.edu \
    --cc=yong.fan@whamcloud.com \
    /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.