From: Jeff Layton <jlayton@redhat.com>
To: Christoph Hellwig <hch@infradead.org>
Cc: linux-cifs-client@lists.samba.org, linux-fsdevel@vger.kernel.org
Subject: Re: [PATCH 03/13] cifs: allow get_cifs_acl to be called without an inode
Date: Wed, 13 May 2009 07:02:02 -0400 [thread overview]
Message-ID: <20090513070202.3d6a5f14@tleilax.poochiereds.net> (raw)
In-Reply-To: <20090513090957.GA9921@infradead.org>
On Wed, 13 May 2009 05:09:57 -0400
Christoph Hellwig <hch@infradead.org> wrote:
> On Mon, May 11, 2009 at 05:03:48PM -0400, Jeff Layton wrote:
> > Looks good. I'll plan to incorporate this or something close to it on
> > the next respin.
>
> Here's a similar one for set_cifs_acl:
>
>
> Signed-off-by: Christoph Hellwig <hch@lst.de>
>
Thanks, looks reasonable. I ended up playing whack-a-mole on another
problem yesterday and didn't get a chance to work on this. I'm about
halfway through respinning these patches to incorporate your comments.
The catch is that we really do want to be able to call get_cifs_acl (or
some variant) w/o a valid inode. What this patchset does is try to
gather up all of the inode info before calling iget5_locked, so it's
quite possible that there won't be an inode to
pass in when we need to fetch the ACL. So, your patch for get_cifs_acl
is a good start, but it'll take a little bit more reorg to get it to
what I need it to do. No biggie though, I'll get something together for
it...
> Index: linux-2.6/fs/cifs/cifsacl.c
> ===================================================================
> --- linux-2.6.orig/fs/cifs/cifsacl.c 2009-05-13 10:58:01.838660889 +0200
> +++ linux-2.6/fs/cifs/cifsacl.c 2009-05-13 11:08:42.006785420 +0200
> @@ -611,57 +611,61 @@ static struct cifs_ntsd *get_cifs_acl(u3
> return pntsd;
> }
>
> -/* Set an ACL on the server */
> -static int set_cifs_acl(struct cifs_ntsd *pnntsd, __u32 acllen,
> - struct inode *inode, const char *path)
> +static int set_cifs_acl_by_fid(struct cifs_sb_info *cifs_sb, __u16 fid,
> + struct cifs_ntsd *pnntsd, u32 acllen)
> {
> - struct cifsFileInfo *open_file;
> - bool unlock_file = false;
> - int xid;
> - int rc = -EIO;
> - __u16 fid;
> - struct super_block *sb;
> - struct cifs_sb_info *cifs_sb;
> + int xid, rc;
>
> - cFYI(DBG2, ("set ACL for %s from mode 0x%x", path, inode->i_mode));
> + xid = GetXid();
> + rc = CIFSSMBSetCIFSACL(xid, cifs_sb->tcon, fid, pnntsd, acllen);
> + FreeXid(xid);
>
> - if (!inode)
> - return rc;
> + cFYI(DBG2, ("SetCIFSACL rc = %d", rc));
> + return rc;
> +}
>
> - sb = inode->i_sb;
> - if (sb == NULL)
> - return rc;
> +static int set_cifs_acl_by_path(struct cifs_sb_info *cifs_sb, const char *path,
> + struct cifs_ntsd *pnntsd, u32 acllen)
> +{
> + int oplock = 0;
> + int xid, rc;
> + __u16 fid;
>
> - cifs_sb = CIFS_SB(sb);
> xid = GetXid();
>
> - open_file = find_readable_file(CIFS_I(inode));
> - if (open_file) {
> - unlock_file = true;
> - fid = open_file->netfid;
> - } else {
> - int oplock = 0;
> - /* open file */
> - rc = CIFSSMBOpen(xid, cifs_sb->tcon, path, FILE_OPEN,
> - WRITE_DAC, 0, &fid, &oplock, NULL,
> - cifs_sb->local_nls, cifs_sb->mnt_cifs_flags &
> - CIFS_MOUNT_MAP_SPECIAL_CHR);
> - if (rc != 0) {
> - cERROR(1, ("Unable to open file to set ACL"));
> - FreeXid(xid);
> - return rc;
> - }
> + rc = CIFSSMBOpen(xid, cifs_sb->tcon, path, FILE_OPEN, WRITE_DAC, 0,
> + &fid, &oplock, NULL, cifs_sb->local_nls,
> + cifs_sb->mnt_cifs_flags & CIFS_MOUNT_MAP_SPECIAL_CHR);
> + if (rc) {
> + cERROR(1, ("Unable to open file to set ACL"));
> + goto out;
> }
>
> rc = CIFSSMBSetCIFSACL(xid, cifs_sb->tcon, fid, pnntsd, acllen);
> cFYI(DBG2, ("SetCIFSACL rc = %d", rc));
> - if (unlock_file)
> - atomic_dec(&open_file->wrtPending);
> - else
> - CIFSSMBClose(xid, cifs_sb->tcon, fid);
>
> + CIFSSMBClose(xid, cifs_sb->tcon, fid);
> + out:
> FreeXid(xid);
> + return rc;
> +}
> +
> +/* Set an ACL on the server */
> +static int set_cifs_acl(struct cifs_ntsd *pnntsd, __u32 acllen,
> + struct inode *inode, const char *path)
> +{
> + struct cifs_sb_info *cifs_sb = CIFS_SB(inode->i_sb);
> + struct cifsFileInfo *open_file;
> + int rc;
> +
> + cFYI(DBG2, ("set ACL for %s from mode 0x%x", path, inode->i_mode));
> +
> + open_file = find_readable_file(CIFS_I(inode));
> + if (!open_file)
> + return set_cifs_acl_by_path(cifs_sb, path, pnntsd, acllen);
>
> + rc = set_cifs_acl_by_fid(cifs_sb, open_file->netfid, pnntsd, acllen);
> + atomic_dec(&open_file->wrtPending);
> return rc;
> }
>
--
Jeff Layton <jlayton@redhat.com>
next prev parent reply other threads:[~2009-05-13 11:02 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-05-11 20:24 [PATCH 00/13] cifs: implement proper hardlink detection Jeff Layton
2009-05-11 20:24 ` [PATCH 01/13] cifs: have cifs_NTtimeToUnix take a little-endian arg Jeff Layton
2009-05-11 20:26 ` Christoph Hellwig
2009-05-11 20:24 ` [PATCH 02/13] cifs: make cnvrtDosUnixTm take a little-endian args and an offset Jeff Layton
2009-05-11 20:27 ` Christoph Hellwig
2009-05-11 20:24 ` [PATCH 03/13] cifs: allow get_cifs_acl to be called without an inode Jeff Layton
2009-05-11 20:56 ` Christoph Hellwig
2009-05-11 21:03 ` Jeff Layton
2009-05-13 9:09 ` Christoph Hellwig
2009-05-13 11:02 ` Jeff Layton [this message]
2009-05-11 20:24 ` [PATCH 04/13] cifs: rename cifs_iget to cifs_root_iget Jeff Layton
2009-05-11 20:24 ` [PATCH 05/13] cifs: add new cifs_fattr struct for holding cifs inode attributes in common way Jeff Layton
2009-05-11 21:01 ` Christoph Hellwig
2009-05-11 20:24 ` [PATCH 06/13] cifs: add new cifs_iget function and convert unix codepath to use it Jeff Layton
2009-05-11 21:06 ` Christoph Hellwig
2009-05-11 20:24 ` [PATCH 07/13] cifs: convert posix readdir codepath to use cifs_iget Jeff Layton
2009-05-11 20:24 ` [PATCH 08/13] cifs: convert cifs_get_inode_info " Jeff Layton
2009-05-11 20:24 ` [PATCH 09/13] cifs: convert non-posix readdir codepath " Jeff Layton
2009-05-11 20:24 ` [PATCH 10/13] cifs: remove cifs_new_inode Jeff Layton
2009-05-11 20:24 ` [PATCH 11/13] cifs: make serverino the default when mounting Jeff Layton
2009-05-11 20:24 ` [PATCH 12/13] cifs: remove cifsInodeInfo->inUse counter Jeff Layton
2009-05-11 20:24 ` [PATCH 13/13] cifs: remove "hardlink detection" from cifs_rename Jeff Layton
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=20090513070202.3d6a5f14@tleilax.poochiereds.net \
--to=jlayton@redhat.com \
--cc=hch@infradead.org \
--cc=linux-cifs-client@lists.samba.org \
--cc=linux-fsdevel@vger.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 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.