From: Greg KH <gregkh@suse.de>
To: Jean Delvare <khali@linux-fr.org>
Cc: "Eric W. Biederman" <ebiederm@xmission.com>,
LKML <linux-kernel@vger.kernel.org>, Tejun Heo <tj@kernel.org>,
Serge Hallyn <serue@us.ibm.com>
Subject: Re: sysfs_chmod_file() broken in 2.6.33-rc4-git6
Date: Thu, 21 Jan 2010 20:19:13 -0800 [thread overview]
Message-ID: <20100122041913.GC4302@suse.de> (raw)
In-Reply-To: <20100120160008.7d59688b@hyperion.delvare>
On Wed, Jan 20, 2010 at 04:00:08PM +0100, Jean Delvare wrote:
> On Wed, 20 Jan 2010 06:01:02 -0800, Eric W. Biederman wrote:
> > Jean Delvare <khali@linux-fr.org> writes:
> >
> > > Hi Eric, Greg,
> > >
> > > While working on a driver using 2.6.33-rc4-git6 as my environment, I
> > > have found that sysfs_chmod_file() called from a kernel driver no
> > > longer works. It doesn't return any error nor print any message in the
> > > logs, it simply has no effect. The same code worked fine using kernel
> > > 2.6.32. I have bisected it down to the following commit:
> > >
> > > commit e61ab4ae48fbf477f5b9fcbec9e1b8dc789920d0
> > > Author: Eric W. Biederman <ebiederm@xmission.com>
> > > Date: Fri Nov 20 16:08:53 2009 -0800
> > >
> > > sysfs: Implement sysfs_getattr & sysfs_permission
> > >
> > > With the implementation of sysfs_getattr and sysfs_permission
> > > sysfs becomes able to lazily propogate inode attribute changes
> > > from the sysfs_dirents to the vfs inodes. This paves the way
> > > for deleting significant chunks of now unnecessary code.
> > >
> > > While doing this we did not reference sysfs_setattr from
> > > sysfs_symlink_inode_operations so I added along with
> > > sysfs_getattr and sysfs_permission.
> > >
> > > Acked-by: Tejun Heo <tj@kernel.org>
> > > Acked-by: Serge Hallyn <serue@us.ibm.com>
> > > Signed-off-by: Eric W. Biederman <ebiederm@aristanetworks.com>
> > > Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
> > >
> > > Eric, can you please look at your code again and see if you can find
> > > any obvious issue?
> >
> > Does this fix your issue?
> >
> > Eric
> >
> >
> > diff --git a/fs/sysfs/inode.c b/fs/sysfs/inode.c
> > index 220b758..6a06a1d 100644
> > --- a/fs/sysfs/inode.c
> > +++ b/fs/sysfs/inode.c
> > @@ -81,24 +81,23 @@ int sysfs_sd_setattr(struct sysfs_dirent *sd, struct iattr * iattr)
> > if (!sd_attrs)
> > return -ENOMEM;
> > sd->s_iattr = sd_attrs;
> > - } else {
> > - /* attributes were changed at least once in past */
> > - iattrs = &sd_attrs->ia_iattr;
> > -
> > - if (ia_valid & ATTR_UID)
> > - iattrs->ia_uid = iattr->ia_uid;
> > - if (ia_valid & ATTR_GID)
> > - iattrs->ia_gid = iattr->ia_gid;
> > - if (ia_valid & ATTR_ATIME)
> > - iattrs->ia_atime = iattr->ia_atime;
> > - if (ia_valid & ATTR_MTIME)
> > - iattrs->ia_mtime = iattr->ia_mtime;
> > - if (ia_valid & ATTR_CTIME)
> > - iattrs->ia_ctime = iattr->ia_ctime;
> > - if (ia_valid & ATTR_MODE) {
> > - umode_t mode = iattr->ia_mode;
> > - iattrs->ia_mode = sd->s_mode = mode;
> > - }
> > + }
> > + /* attributes were changed at least once in past */
> > + iattrs = &sd_attrs->ia_iattr;
> > +
> > + if (ia_valid & ATTR_UID)
> > + iattrs->ia_uid = iattr->ia_uid;
> > + if (ia_valid & ATTR_GID)
> > + iattrs->ia_gid = iattr->ia_gid;
> > + if (ia_valid & ATTR_ATIME)
> > + iattrs->ia_atime = iattr->ia_atime;
> > + if (ia_valid & ATTR_MTIME)
> > + iattrs->ia_mtime = iattr->ia_mtime;
> > + if (ia_valid & ATTR_CTIME)
> > + iattrs->ia_ctime = iattr->ia_ctime;
> > + if (ia_valid & ATTR_MODE) {
> > + umode_t mode = iattr->ia_mode;
> > + iattrs->ia_mode = sd->s_mode = mode;
> > }
> > return 0;
> > }
>
> Yes, this fixes my problem. Thanks for the fast fix!
Great, Eric, care to resend this so that I can submit it for inclusion?
thanks,
greg k-h
next prev parent reply other threads:[~2010-01-22 4:28 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20100120131602.12aa48f7@hyperion.delvare>
2010-01-20 14:01 ` sysfs_chmod_file() broken in 2.6.33-rc4-git6 Eric W. Biederman
2010-01-20 15:00 ` Jean Delvare
2010-01-22 4:19 ` Greg KH [this message]
2010-02-03 8:11 ` Jean Delvare
2010-02-03 14:22 ` Greg KH
2010-02-04 7:05 ` Eric W. Biederman
2010-02-04 7:13 ` [PATCH] sysfs: sysfs_sd_setattr set iattrs unconditionally Eric W. Biederman
2010-02-04 8:36 ` Jean Delvare
2010-02-11 15:33 ` Eric W. Biederman
2010-02-11 15:52 ` Greg KH
2010-02-11 16:05 ` Eric W. Biederman
2010-02-04 7:32 ` [PATCH] sysfs: sysfs_setattr " Eric W. Biederman
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=20100122041913.GC4302@suse.de \
--to=gregkh@suse.de \
--cc=ebiederm@xmission.com \
--cc=khali@linux-fr.org \
--cc=linux-kernel@vger.kernel.org \
--cc=serue@us.ibm.com \
--cc=tj@kernel.org \
/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;
as well as URLs for NNTP newsgroup(s).