From patchwork Fri Mar 18 09:02:07 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sean Finney X-Patchwork-Id: 662441 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 p2PEO2UE010624 for ; Fri, 25 Mar 2011 14:24:02 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753578Ab1CYOYB (ORCPT ); Fri, 25 Mar 2011 10:24:01 -0400 Received: from cobija.connexer.com ([66.93.22.232]:60917 "EHLO cobija.connexer.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753549Ab1CYOYA (ORCPT ); Fri, 25 Mar 2011 10:24:00 -0400 Received: by cobija.connexer.com (Postfix, from userid 1000) id D3DB830009; Fri, 25 Mar 2011 10:23:57 -0400 (EDT) Message-Id: From: Sean Finney Date: Fri, 18 Mar 2011 10:02:07 +0100 Subject: [PATCH 1/2] Fix Bug#31092: Unable to mount DFS filesystems from Windows 2008 servers To: linux-cifs@vger.kernel.org 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.6 (demeter1.kernel.org [140.211.167.41]); Fri, 25 Mar 2011 14:24:02 +0000 (UTC) diff --git a/fs/cifs/connect.c b/fs/cifs/connect.c index 96544a4..7e4ca38 100644 --- a/fs/cifs/connect.c +++ b/fs/cifs/connect.c @@ -2874,6 +2874,56 @@ try_mount_again: (tcon->ses->server->maxBuf - MAX_CIFS_HDR_SIZE)); remote_path_check: +#ifdef CONFIG_CIFS_DFS_UPCALL + /* + * Perform an unconditional check for whether there are + * DFS referrals for this path (without prefix), to provide + * some limited support for domain DFS referrals on w2k8 + */ + if (referral_walks_count == 0) { + cFYI(1, "Getting referral for: %s", volume_info->UNC); + rc = get_dfs_path(xid, pSesInfo , volume_info->UNC + 1, + cifs_sb->local_nls, &num_referrals, &referrals, + cifs_sb->mnt_cifs_flags & CIFS_MOUNT_MAP_SPECIAL_CHR); + if (!rc && num_referrals > 0) { + char *fake_devname = NULL; + + full_path = build_unc_path_to_root(volume_info, + cifs_sb); + if (IS_ERR(full_path)) { + rc = PTR_ERR(full_path); + goto mount_fail_check; + } + + if (mount_data != mount_data_global) + kfree(mount_data); + + mount_data = cifs_compose_mount_options( + cifs_sb->mountdata, full_path + 1, + referrals, &fake_devname); + + free_dfs_info_array(referrals, num_referrals); + kfree(fake_devname); + + if (IS_ERR(mount_data)) { + rc = PTR_ERR(mount_data); + mount_data = NULL; + goto mount_fail_check; + } + + if (tcon) + cifs_put_tcon(tcon); + else if (pSesInfo) + cifs_put_smb_ses(pSesInfo); + + cleanup_volume_info(&volume_info); + referral_walks_count++; + FreeXid(xid); + goto try_mount_again; + } + } +#endif + /* check if a whole path (including prepath) is not remote */ if (!rc && tcon) { /* build_path_to_root works only when we have a valid tcon */