From patchwork Mon Nov 30 11:15:59 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Suresh Jayaraman X-Patchwork-Id: 39794 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.samba.org (fn.samba.org [216.83.154.106]) by ozlabs.org (Postfix) with ESMTP id 032E31007D3 for ; Mon, 30 Nov 2009 22:16:11 +1100 (EST) Received: from fn.samba.org (localhost [127.0.0.1]) by lists.samba.org (Postfix) with ESMTP id AE4D9AD1F7; Mon, 30 Nov 2009 04:13:53 -0700 (MST) X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on fn.samba.org X-Spam-Level: X-Spam-Status: No, score=-8.3 required=3.8 tests=AWL, BAYES_00, RCVD_IN_DNSWL_HI autolearn=ham version=3.2.5 X-Original-To: linux-cifs-client@lists.samba.org Delivered-To: linux-cifs-client@lists.samba.org Received: from mx1.suse.de (cantor.suse.de [195.135.220.2]) by lists.samba.org (Postfix) with ESMTP id 4C4E6AD1F6 for ; Mon, 30 Nov 2009 04:13:48 -0700 (MST) Received: from relay2.suse.de (charybdis-ext.suse.de [195.135.221.2]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.suse.de (Postfix) with ESMTP id CD3AF5362F for ; Mon, 30 Nov 2009 12:16:03 +0100 (CET) Message-ID: <4B13A96F.20105@suse.de> Date: Mon, 30 Nov 2009 16:45:59 +0530 From: Suresh Jayaraman User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.1.4pre) Gecko/20090915 SUSE/3.0b4-3.6 Thunderbird/3.0b4 MIME-Version: 1.0 To: linux-cifs-client@lists.samba.org References: In-Reply-To: Subject: Re: [linux-cifs-client] surprise behavior #1: ENOENT for existing directories X-BeenThere: linux-cifs-client@lists.samba.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: The Linux CIFS VFS client List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: linux-cifs-client-bounces@lists.samba.org Errors-To: linux-cifs-client-bounces@lists.samba.org On 11/30/2009 07:46 AM, aaron brick wrote: > i am having two intermittent problems with CIFS and am sending > separate emails to the list for each. this paragraph is identical. my > desktop runs debian and kernel 2.6.32rc7; i am mounting a filesystem > from my synology NAS, running DSM 2.2-0942 and using ext3 & RAID5 > internally. the link is gigabit through cat5e and a netgear switch. > the only CIFS dmesg entry i see is a couple of: "CIFS VFS: server > 10.1.1.2 of type Samba 3.2.8 returned unexpected error on SMB posix > open, disabling posix open support. Check if server update available." > (FWIW, synology hasn't released a firmware with a more recent samba.) > > > here, creating files within a directory sometimes fails with ENOENT as > if the parent did not exist. this generally prevents me from using the > shared filesystem for compilation. an example follows: > > > 11:08 / > mount | grep nas > //nas/data on /data type cifs (rw,mand) > 11:08 / > cd data > 11:08 /data > mkdir a > 11:08 /data > mkdir a/b > mkdir: cannot create directory `a/b': No such file or directory > 11:08 /data > strace mkdir a/b |& grep mkdir > execve("/bin/mkdir", ["mkdir", "a/b"], [/* 22 vars */]) = 0 > mkdir("a/b", 0777) = -1 ENOENT (No such file or directory) > write(2, "mkdir: ", 7mkdir: ) = 7 > I have not been able to reproduce this 2.6.31-rc1 against Samba 3.2.7. But a quick look at the code suggests there could be a problem if we do this sequence: POSIX open against Samba server < 3.3.1 (tcon->broken_posix_open will be set) followed by a mkdir (will call CIFSPOSIXCreate). As we don't seem to check whether the broken_posix_open is set, this might have led to this issue I think. Does the following patch (a quick, untested) fix the issue? fs/cifs/inode.c | 3 ++- 1 files changed, 2 insertions(+), 1 deletions(-) Thanks, diff --git a/fs/cifs/inode.c b/fs/cifs/inode.c index cababd8..f1e9ab6 100644 --- a/fs/cifs/inode.c +++ b/fs/cifs/inode.c @@ -1038,7 +1038,8 @@ int cifs_mkdir(struct inode *inode, struct dentry *direntry, int mode) return rc; } - if ((pTcon->ses->capabilities & CAP_UNIX) && + if (!tcon->broken_posix_open && tcon->unix_ext && + (pTcon->ses->capabilities & CAP_UNIX) && (CIFS_UNIX_POSIX_PATH_OPS_CAP & le64_to_cpu(pTcon->fsUnixInfo.Capability))) { u32 oplock = 0;