From patchwork Tue Jul 30 15:38:44 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jeff Layton X-Patchwork-Id: 2835778 Return-Path: X-Original-To: patchwork-cifs-client@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id A127DC0319 for ; Tue, 30 Jul 2013 15:38:58 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id E444C2051B for ; Tue, 30 Jul 2013 15:38:53 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 77E7D2051A for ; Tue, 30 Jul 2013 15:38:52 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755118Ab3G3Piw (ORCPT ); Tue, 30 Jul 2013 11:38:52 -0400 Received: from mail-ve0-f170.google.com ([209.85.128.170]:35598 "EHLO mail-ve0-f170.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751725Ab3G3Piv (ORCPT ); Tue, 30 Jul 2013 11:38:51 -0400 Received: by mail-ve0-f170.google.com with SMTP id 15so1563297vea.1 for ; Tue, 30 Jul 2013 08:38:50 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=sender:from:to:cc:subject:date:message-id:x-mailer :x-gm-message-state; bh=g5nsfZZmqkjHeIY7trJQW6M0Wm0dZ+KFZbeJJbUXPbY=; b=E5iv7N67ttYVLi7k0qO4zK9TkCmqHvJPykv0XIgGIWfeNPW2+znyxPTyqPAJ5PWeUy Le3d2aZfkfvz61LD/V4AlTUS2uw4kzjJODNDl916cYkfBJjdwuoaZo0+ih3Inzt2vran 8BIE96/tw4gIDbeYtjBAPpcwv69o9yjx4jGwMhloV472egsJ4v/YbNIIlNxSuUN+fNoc fHk7YLq2XrNf8t2JYko+0hNiFSvHk0GOL9Dgt+Wwf/qRjT4XWjhYYrVcx9YjX1+PiZS/ Rekpo35TOUQ0zyveLVg82zlHhPCD899i9A7MWBllWjgQDqrkd4QgRSsuXnszgapIpAkO WKFw== X-Received: by 10.52.163.12 with SMTP id ye12mr11046526vdb.59.1375198730615; Tue, 30 Jul 2013 08:38:50 -0700 (PDT) Received: from salusa.poochiereds.net (cpe-107-015-124-230.nc.res.rr.com. [107.15.124.230]) by mx.google.com with ESMTPSA id p5sm30109116vek.1.2013.07.30.08.38.49 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Tue, 30 Jul 2013 08:38:49 -0700 (PDT) From: Jeff Layton To: Steve French Cc: linux-cifs@vger.kernel.org, Jan-Marek Glogowski , Al Viro , Ian Kent Subject: [PATCH] cifs: set sb->s_d_op before calling d_make_root() Date: Tue, 30 Jul 2013 11:38:44 -0400 Message-Id: <1375198724-22857-1-git-send-email-jlayton@redhat.com> X-Mailer: git-send-email 1.8.3.1 X-Gm-Message-State: ALoCoQmegV6vU8PA6ksx42UI05Eu3Icmcjcc2RcX/jFFhwOYDoOUXjmgM6ssen26NLyFt/QTxuZ9 Sender: linux-cifs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-cifs@vger.kernel.org X-Spam-Status: No, score=-8.4 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Currently, the s_root dentry doesn't get its d_op pointer set to anything. This breaks lookups in the root of case-insensitive mounts since that relies on having d_hash and d_compare routines that know to treat the filename as case-insensitive. cifs.ko has been broken this way for a long time, but commit 1c929cfe6 ("switch cifs"), added a cryptic comment which is removed in the patch below, which makes me wonder if this was done deliberately for some reason. It's not clear to me why we'd want the s_root not to have d_op set properly. It may have something to do with d_automount or d_revalidate on the root, but my suspicion in looking over the code is that Al was just trying to preserve the existing behavior when changing this code over to use s_d_op. This patch changes it so that we set s_d_op before calling d_make_root and removes the comment. I tested mounting, accessing and unmounting several types of shares (including DFS referrals) and everything still seemed to work OK afterward. I could be missing something however, so please do let me know if I am. Reported-by: Jan-Marek Glogowski Cc: Al Viro Cc: Ian Kent Signed-off-by: Jeff Layton --- fs/cifs/cifsfs.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/fs/cifs/cifsfs.c b/fs/cifs/cifsfs.c index 4bdd547..85ea98d 100644 --- a/fs/cifs/cifsfs.c +++ b/fs/cifs/cifsfs.c @@ -147,18 +147,17 @@ cifs_read_super(struct super_block *sb) goto out_no_root; } + if (cifs_sb_master_tcon(cifs_sb)->nocase) + sb->s_d_op = &cifs_ci_dentry_ops; + else + sb->s_d_op = &cifs_dentry_ops; + sb->s_root = d_make_root(inode); if (!sb->s_root) { rc = -ENOMEM; goto out_no_root; } - /* do that *after* d_make_root() - we want NULL ->d_op for root here */ - if (cifs_sb_master_tcon(cifs_sb)->nocase) - sb->s_d_op = &cifs_ci_dentry_ops; - else - sb->s_d_op = &cifs_dentry_ops; - #ifdef CONFIG_CIFS_NFSD_EXPORT if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_SERVER_INUM) { cifs_dbg(FYI, "export ops supported\n");