From patchwork Fri Jun 19 12:40:33 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jeff Layton X-Patchwork-Id: 31329 Received: from lists.samba.org (mail.samba.org [66.70.73.150]) by demeter.kernel.org (8.14.2/8.14.2) with ESMTP id n5JCk5KT013856 for ; Fri, 19 Jun 2009 12:46:05 GMT Received: from dp.samba.org (localhost [127.0.0.1]) by lists.samba.org (Postfix) with ESMTP id 98CCD163C2E for ; Fri, 19 Jun 2009 12:45:31 +0000 (GMT) X-Spam-Checker-Version: SpamAssassin 3.1.7 (2006-10-05) on dp.samba.org X-Spam-Level: X-Spam-Status: No, score=-3.8 required=3.8 tests=AWL,BAYES_00, FORGED_RCVD_HELO,SPF_HELO_PASS,SPF_PASS autolearn=ham version=3.1.7 X-Original-To: linux-cifs-client@lists.samba.org Delivered-To: linux-cifs-client@lists.samba.org Received: from mx2.redhat.com (mx2.redhat.com [66.187.237.31]) by lists.samba.org (Postfix) with ESMTP id 87508163ADD for ; Fri, 19 Jun 2009 12:40:03 +0000 (GMT) Received: from int-mx2.corp.redhat.com (int-mx2.corp.redhat.com [172.16.27.26]) by mx2.redhat.com (8.13.8/8.13.8) with ESMTP id n5JCeaSC012948; Fri, 19 Jun 2009 08:40:36 -0400 Received: from ns3.rdu.redhat.com (ns3.rdu.redhat.com [10.11.255.199]) by int-mx2.corp.redhat.com (8.13.1/8.13.1) with ESMTP id n5JCeZOo022474; Fri, 19 Jun 2009 08:40:35 -0400 Received: from tlielax.poochiereds.net (vpn-12-178.rdu.redhat.com [10.11.12.178]) by ns3.rdu.redhat.com (8.13.8/8.13.8) with ESMTP id n5JCeYtE018012; Fri, 19 Jun 2009 08:40:34 -0400 Date: Fri, 19 Jun 2009 08:40:33 -0400 From: Jeff Layton To: Jeff Layton Subject: Re: [linux-cifs-client] perm error on mount point Message-ID: <20090619084033.1e3d1c9a@tlielax.poochiereds.net> In-Reply-To: <20090619070134.10cac513@tlielax.poochiereds.net> References: <063eeffea5bba01bf0eaa400670f449d@localhost> <20090618113130.5d13db23@barsoom.rdu.redhat.com> <699f5a6bc408295d9a1a666764a172a7@localhost> <20090619070134.10cac513@tlielax.poochiereds.net> Mime-Version: 1.0 X-Scanned-By: MIMEDefang 2.58 on 172.16.27.26 Cc: smfrench@gmail.com, pouchat@peewiki.net, linux-cifs-client@lists.samba.org X-BeenThere: linux-cifs-client@lists.samba.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: The Linux CIFS VFS client List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: linux-cifs-client-bounces+patchwork-cifs-client=patchwork.kernel.org@lists.samba.org Errors-To: linux-cifs-client-bounces+patchwork-cifs-client=patchwork.kernel.org@lists.samba.org On Fri, 19 Jun 2009 07:01:34 -0400 Jeff Layton wrote: > On Fri, 19 Jun 2009 08:46:11 +0200 > wrote: > > > > On Thu, 18 Jun 2009 11:31:30 -0400, Jeff Layton > > wrote: > > > > > > No. Is there some reason you feel the need to pretend that the > > > directory is writable when it isn't? > > > > Yes, because it is writable : my share are ALL WRITABLE for user (username > > and uid > > option that i pass during the mount). So 2.6.24 have FOR ME the correct > > behaviour (perms). During my search i've also found that force the > > dir_mode to 0000 solve partially my problem : writable, but only for > > root... > > > > Finally, the problem (often) come from microsoft : they use the read only > > attribut instead of the system attribut. As they discuss in this page > > http://support.microsoft.com/kb/256614 on readonly bit : "some programs can > > display errors while trying to write file in this - fake readonly - dir". > > Maybe the case with cifs in kernel 2.6.26 or later. I've tried the regedit > > they proprosed and after reload cifs all my shares were mounted with > > corrects > > perms : rwxr-xr-x instead of r-x-r-xr-x. > > > > So for the moment it works, hope for a long time ;) and thanks for > > spending time to answer and to help ! > > (cc'ing Steve) > > Thanks for the pointer. This article actually has a little more info: > > http://support.microsoft.com/kb/326549/ > > Here's a key phrase: > > "Unlike the Read-only attribute for a file, the Read-only attribute for > a folder is typically ignored by Windows, Windows components and > accessories, and other programs." > > ...perhaps we need to change this behavior so that the write bit isn't > cleared on directories with ATTR_READONLY set? What's samba's behavior > in this regard? > > Steve, thoughts? > Since it sounds like we should change this behavior, this untested patch should should correct this behavior. It should apply cleanly on top of the cifs_iget patchset. >From 9307c6ca7ead856617a6758a394b1002008a75eb Mon Sep 17 00:00:00 2001 From: Jeff Layton Date: Fri, 19 Jun 2009 08:37:49 -0400 Subject: [PATCH] cifs: when ATTR_READONLY is set, only clear write bits on non-directories On windows servers, ATTR_READONLY apparently either has no meaning or serves as some sort of queue to certain applications for unrelated behavior. This MS kbase article has details: http://support.microsoft.com/kb/326549/ Don't clear the write bits directory mode when ATTR_READONLY is set. Reported-by: pouchat@peewiki.net Signed-off-by: Jeff Layton --- fs/cifs/inode.c | 8 ++++---- 1 files changed, 4 insertions(+), 4 deletions(-) diff --git a/fs/cifs/inode.c b/fs/cifs/inode.c index 9195caf..73d7d3d 100644 --- a/fs/cifs/inode.c +++ b/fs/cifs/inode.c @@ -419,11 +419,11 @@ cifs_all_info_to_fattr(struct cifs_fattr *fattr, FILE_ALL_INFO *info, } else { fattr->cf_mode = S_IFREG | cifs_sb->mnt_file_mode; fattr->cf_dtype = DT_REG; - } - /* clear write bits if ATTR_READONLY is set */ - if (fattr->cf_cifsattrs & ATTR_READONLY) - fattr->cf_mode &= ~(S_IWUGO); + /* clear write bits if ATTR_READONLY is set */ + if (fattr->cf_cifsattrs & ATTR_READONLY) + fattr->cf_mode &= ~(S_IWUGO); + } fattr->cf_nlink = le32_to_cpu(info->NumberOfLinks); -- 1.6.0.6