All of lore.kernel.org
 help / color / mirror / Atom feed
From: Alberto Bertogli <albertito@gmail.com>
To: Blaisorblade <blaisorblade@yahoo.it>
Cc: user-mode-linux-devel@lists.sourceforge.net
Subject: Re: [uml-devel] [PATCH] Make hostfs_setattr() support operations	on closed files.
Date: Wed, 25 Apr 2007 22:43:07 -0300	[thread overview]
Message-ID: <20070426014307.GE31191@gmail.com> (raw)
In-Reply-To: <200704251751.11461.blaisorblade@yahoo.it>

On Wed, Apr 25, 2007 at 05:51:10PM +0200, Blaisorblade wrote:
> On martedì 24 aprile 2007, Alberto Bertogli wrote:
> > This patch allows hostfs_setattr() to work on closed files by calling
> > set_attr() (the userspace part) with the inode's fd.
> >
> > Without this, applications that depend on doing attribute changes to
> > closed files will fail.
> >
> > It works by using the fd versions instead of the path ones (for example
> > fchmod() instead of chmod(), fchown() instead of chown()) when an fd is
> > available.
> >
> >
> > Signed-off-by: Alberto Bertogli <albertito@gmail.com>
> > ---
> This makes sense and is useful - but:
> 1) when I read the examples, I understood you meant 'unlinked open files', 
> not 'closed files'. Right?

Right, sorry about that, the terminology I used is completely
misleading. I'll change the description.


> The patch is of good quality; I've not seen any single bug, which is rare in 
> such submission, but before merging, some little things should be fixed up 
> (either by you or by Jeff).
> 
> 2) if (...) return ...; on a single line is horrible style, should be 
> corrected (I see sometimes the original code uses it, well it shouldn't).

I couldn't agree more. I did it that way because I tried to follow the
coding style of the original code.


> > In the host fchmod() changes f1 and not f1.tmp, but maybe the open() in the
> > middle got hostfs confused. Luckily this is not the case and it works fine;
> > but as I'm not familiar with hostfs there may be other issues.
> 
> I guess the patch would make this work, right?

Yes, that case works with the patch.


> > diff --git a/fs/hostfs/hostfs_kern.c b/fs/hostfs/hostfs_kern.c
> > index fd301a9..c704d9c 100644
> 
> > @@ -817,8 +817,14 @@ int hostfs_permission(struct inode *ino, int desired,
> > struct nameidata *nd) int hostfs_setattr(struct dentry *dentry, struct
> > iattr *attr)
> >  {
> >  	struct hostfs_iattr attrs;
> > +	struct hostfs_inode_info *iinfo;
> >  	char *name;
> >  	int err;
> > +	int fd = -1;
> > +
> > +	iinfo = HOSTFS_I(dentry->d_inode);
> > +	if (iinfo != NULL)
> > +		fd = iinfo->fd;
> 
> iinfo cannot be NULL, so please remove that if. HOSTFS_I does not access a 
> field of d_inode; rather, d_inode points to a field of iinfo, i.e. the 
> vfs_inode field of struct hostfs_inode_info.

That's good to know =) I'll fix it.


> I do not like the below code. The different code is for setting buf; what 
> follows that is common to all cases, and the conversion probably should be 
> factored out into a conversion function for better clarity: verifying what 
> the code does is difficult here.

I agree. I tried to make the changes to look as much as possible to the
original, but if you want me to reorganize that code a bit, I'll be glad
to give it a try.


I'll address all these issues and post and updated patch (probably
tomorrow).

Thanks a lot,
		Alberto



-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
User-mode-linux-devel mailing list
User-mode-linux-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel


  reply	other threads:[~2007-04-26  1:42 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-04-24 14:26 [uml-devel] [PATCH] Make hostfs_setattr() support operations on closed files Alberto Bertogli
2007-04-25 15:51 ` Blaisorblade
2007-04-26  1:43   ` Alberto Bertogli [this message]
2007-04-26  5:15 ` Alberto Bertogli

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=20070426014307.GE31191@gmail.com \
    --to=albertito@gmail.com \
    --cc=blaisorblade@yahoo.it \
    --cc=user-mode-linux-devel@lists.sourceforge.net \
    /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.