From patchwork Thu Oct 7 18:46:28 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jeff Layton X-Patchwork-Id: 238661 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter1.kernel.org (8.14.4/8.14.3) with ESMTP id o97Ikc3d018933 for ; Thu, 7 Oct 2010 18:46:38 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751647Ab0JGSqb (ORCPT ); Thu, 7 Oct 2010 14:46:31 -0400 Received: from cdptpa-omtalb.mail.rr.com ([75.180.132.120]:51640 "EHLO cdptpa-omtalb.mail.rr.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750992Ab0JGSqa (ORCPT ); Thu, 7 Oct 2010 14:46:30 -0400 X-Authority-Analysis: v=1.1 cv=R3xZCyK5Rzzq4RgmEA8QIQ3hFZTdsD3z+kRPUs1QTwQ= c=1 sm=0 a=StBJ5mGM1PsA:10 a=ld/erqUjW76FpBUqCqkKeA==:17 a=20KFwNOVAAAA:8 a=W39IS_ATJ-CX3811jREA:9 a=yPOgb6EwH93X7nZiYb8A:7 a=eXPyuqe8f56FaKd16CQz0aKHR30A:4 a=jEp0ucaQiEUA:10 a=ld/erqUjW76FpBUqCqkKeA==:117 X-Cloudmark-Score: 0 X-Originating-IP: 71.70.153.3 Received: from [71.70.153.3] ([71.70.153.3:58770] helo=mail.poochiereds.net) by cdptpa-oedge01.mail.rr.com (envelope-from ) (ecelerity 2.2.3.46 r()) with ESMTP id 8A/5F-06710-5851EAC4; Thu, 07 Oct 2010 18:46:29 +0000 Received: by mail.poochiereds.net (Postfix, from userid 4447) id 1AEBC58180; Thu, 7 Oct 2010 14:46:29 -0400 (EDT) From: Jeff Layton To: smfrench@gmail.com Cc: linux-cifs@vger.kernel.org Subject: [PATCH] cifs: on multiuser mount, set ownership to current_fsuid/current_fsgid (try #5) Date: Thu, 7 Oct 2010 14:46:28 -0400 Message-Id: <1286477188-26681-1-git-send-email-jlayton@redhat.com> X-Mailer: git-send-email 1.7.2.3 Sender: linux-cifs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-cifs@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.3 (demeter1.kernel.org [140.211.167.41]); Thu, 07 Oct 2010 18:46:38 +0000 (UTC) diff --git a/fs/cifs/inode.c b/fs/cifs/inode.c index dcd0886..7cf3d93 100644 --- a/fs/cifs/inode.c +++ b/fs/cifs/inode.c @@ -1761,11 +1761,21 @@ check_inval: int cifs_getattr(struct vfsmount *mnt, struct dentry *dentry, struct kstat *stat) { + struct cifs_sb_info *cifs_sb = CIFS_SB(dentry->d_sb); + struct cifsTconInfo *tcon = cifs_sb_master_tcon(cifs_sb); int err = cifs_revalidate_dentry(dentry); + if (!err) { generic_fillattr(dentry->d_inode, stat); stat->blksize = CIFS_MAX_MSGSIZE; stat->ino = CIFS_I(dentry->d_inode)->uniqueid; + if ((cifs_sb->mnt_cifs_flags & CIFS_MOUNT_MULTIUSER) && + !tcon->unix_ext) { + if (!cifs_sb->mnt_uid) + stat->uid = current_fsuid(); + if (!cifs_sb->mnt_uid) + stat->gid = current_fsgid(); + } } return err; }