Linux NFS development
 help / color / mirror / Atom feed
From: "J. Bruce Fields" <bfields@fieldses.org>
To: Wengang Wang <wen.gang.wang@oracle.com>
Cc: linux-nfs@vger.kernel.org, greg.marsden@oracle.com
Subject: Re: [PATCH 1/1] nfsd(v2/v3): fix the failure of creation from HPUX client --revised
Date: Mon, 9 Feb 2009 12:11:31 -0500	[thread overview]
Message-ID: <20090209171131.GG10297@fieldses.org> (raw)
In-Reply-To: <498BA760.2090603@oracle.com>

On Fri, Feb 06, 2009 at 10:58:40AM +0800, Wengang Wang wrote:
> J. Bruce Fields wrote:
>> On Mon, Jan 12, 2009 at 08:14:46PM +0800, wengang wang wrote:
>>> for descriptions for the problem and solution please see my former post with
>>> Subject "nfsd(v2/v3): fix the failure of creation from HPUX client".
>>
>> Could you just repeat that introduction each time?  I want to commit it
>> with the patch, and that will save me some work hunting down the old
>> email.
>
> Sorry.
> OK, will follow that for later patch postings.

Thanks.

>> It seems that all newfile does is tell us whether the net thing that was
>> created is a regular file or not.  Does it even make sense to set size
>> on other objects?  If not, then why not just make this:
>>
>> 	if (iap->ia_size == 0)
>> 		iap->ia_valid &= ~ATTR_SIZE;
>>
>> and remove the need for "newfile"?
>>
>
> I want it tell us whether it's new created(vfs_create()ed) file or a  
> already existing one to be truncated.
> the later is in case of
>
> if (dchild->d_inode) {
> 	...
> 	switch (createmode) {
> 	case NFS3_CREATE_UNCHECKED:
> 		...
> 		else {
> 			...
> 			goto set_attr;
> 	
> I think we should resize file to zero for the truncating case.
> maybe I'm wrong somethere?

OK, sorry, you're right, I missed the "goto" in the nfsd_create_v3()
case.  And in other cases we still want the permission check to handle,
I guess.  Fair enough.

> From a quick look at nfsd_setattr() it appears
>> it's doing all permissions checks with NFSD_MAY_OWNER_OVERRIDE, which
>> should allow the setting of size, even in the case of mode 0, as long as
>> the caller is the owner of the new file.  
>
> I think you are mentioning the call nfsd_permission() in nfsd_setattr().
> if you are, the call is under a condition of
> 	if (iap->ia_size < inode->i_size) {
> in this case iap->ia_size(being 0) equals to inode->i_size, so  
> nfsd_permission() is not called.
>
> and from above call trace, it's not within nfsd_permission() where error  
> returns.

Yeah, OK, and OWNER_OVERRIDE isn't really what we want in this case
anyway, since the client doesn't know whether the operation will be a
create and so can't check these permissions for us as it can in the case
of writes.

That being the case, I admit, your first attempt looks simpler.  Could
you just do that, but move the common code (and comment) into a helper
function called from the same two places?

--b.

      reply	other threads:[~2009-02-09 17:11 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-01-12 12:14 [PATCH 1/1] nfsd(v2/v3): fix the failure of creation from HPUX client --revised wengang wang
     [not found] ` <200901121216.n0CCGYMx001106-eiegoW5zEh26xOVM2wN62FaTQe2KTcn/@public.gmane.org>
2009-02-04 23:49   ` J. Bruce Fields
2009-02-06  2:58     ` Wengang Wang
2009-02-09 17:11       ` 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=20090209171131.GG10297@fieldses.org \
    --to=bfields@fieldses.org \
    --cc=greg.marsden@oracle.com \
    --cc=linux-nfs@vger.kernel.org \
    --cc=wen.gang.wang@oracle.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox