From patchwork Mon Oct 22 05:01:10 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shirish Pargaonkar X-Patchwork-Id: 1623351 Return-Path: X-Original-To: patchwork-cifs-client@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork1.kernel.org (Postfix) with ESMTP id B6033400E8 for ; Mon, 22 Oct 2012 04:51:17 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752206Ab2JVEvR (ORCPT ); Mon, 22 Oct 2012 00:51:17 -0400 Received: from mail-oa0-f46.google.com ([209.85.219.46]:59923 "EHLO mail-oa0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751392Ab2JVEvQ (ORCPT ); Mon, 22 Oct 2012 00:51:16 -0400 Received: by mail-oa0-f46.google.com with SMTP id h16so2073566oag.19 for ; Sun, 21 Oct 2012 21:51:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:x-mailer; bh=ZgJgyTJl0zh1AHhQsc0MDXkEeWJ07FnPM0mj6A9gGCg=; b=hKy7L4TnjDht2GkeMvVcjGajWH3hmLQ2eYiqvZaJ39AhR6EqKYby26WLNnnd8E92Vg 6h1ar0saf415Jup9pYYwZ3zovVLYk/lfaFB4VN9N3MBem2yYcSXeTyJKwImilJlkVFZB T+xePkJa+b/OB8oUu8nhmxCjd4XfoY/XwCZMHnYFyKLQr4Ge9RowpPvQvvuQdessLa9m HmwU+10K0CP2us8n9OsRTuhEM8+44nSTkikm865Uf5NmCTcJ9rTPQYftwqypV8VIO0Hw AemOXgBzlieYtT4PFR9JZkd9r73mUQ++ew4DWoSs5V4wcNmXT2BW2lyh8SSWKHJVflLV 0hWw== Received: by 10.60.169.198 with SMTP id ag6mr7005047oec.35.1350881476243; Sun, 21 Oct 2012 21:51:16 -0700 (PDT) Received: from localhost ([32.97.110.50]) by mx.google.com with ESMTPS id n7sm9011031obd.16.2012.10.21.21.51.15 (version=TLSv1/SSLv3 cipher=OTHER); Sun, 21 Oct 2012 21:51:15 -0700 (PDT) From: shirishpargaonkar@gmail.com To: smfrench@gmail.com Cc: linux-cifs@vger.kernel.org Subject: diff --git a/fs/cifs/cifsfs.c b/fs/cifs/cifsfs.c Date: Mon, 22 Oct 2012 00:01:10 -0500 Message-Id: <1350882070-6620-1-git-send-email-shirishpargaonkar@gmail.com> X-Mailer: git-send-email 1.6.0.2 Sender: linux-cifs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-cifs@vger.kernel.org -- To unsubscribe from this list: send the line "unsubscribe linux-cifs" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/fs/cifs/cifsglob.h b/fs/cifs/cifsglob.h index f5af252..26d65c7 100644 --- a/fs/cifs/cifsglob.h +++ b/fs/cifs/cifsglob.h @@ -1251,6 +1251,7 @@ struct dfs_info3_param { #define CIFS_FATTR_DELETE_PENDING 0x2 #define CIFS_FATTR_NEED_REVAL 0x4 #define CIFS_FATTR_INO_COLLISION 0x8 +#define CIFS_FATTR_ALTDATASTR 0x10 struct cifs_fattr { u32 cf_flags; @@ -1268,6 +1269,7 @@ struct cifs_fattr { struct timespec cf_atime; struct timespec cf_mtime; struct timespec cf_ctime; + char *cf_private; }; static inline void free_dfs_info_param(struct dfs_info3_param *param) diff --git a/fs/cifs/inode.c b/fs/cifs/inode.c index afdff79..201ec46 100644 --- a/fs/cifs/inode.c +++ b/fs/cifs/inode.c @@ -615,10 +615,12 @@ cifs_get_inode_info(struct inode **inode, const char *full_path, struct tcon_link *tlink; struct cifs_sb_info *cifs_sb = CIFS_SB(sb); char *buf = NULL; + char *altstr = NULL; bool adjust_tz = false; struct cifs_fattr fattr; struct cifs_search_info *srchinf = NULL; + fattr.cf_private = NULL; tlink = cifs_sb_tlink(cifs_sb); if (IS_ERR(tlink)) return PTR_ERR(tlink); @@ -746,14 +748,34 @@ cifs_get_inode_info(struct inode **inode, const char *full_path, } if (!*inode) { + altstr = strchr(full_path, ':'); + if (altstr) { + fattr.cf_private = kstrdup(altstr, GFP_KERNEL); + if (!fattr.cf_private) { + rc = -ENOMEM; + goto cgii_exit; + } + fattr.cf_flags |= CIFS_FATTR_ALTDATASTR; + } + *inode = cifs_iget(sb, &fattr); - if (!*inode) + if (*inode) { + if (altstr && !((*inode)->i_flags & S_PRIVATE)) { + (*inode)->i_private = + kstrdup(altstr, GFP_KERNEL); + if ((*inode)->i_private) + (*inode)->i_flags |= S_PRIVATE; + else + rc = -ENOMEM; + } + } else rc = -ENOMEM; } else { cifs_fattr_to_inode(*inode, &fattr); } cgii_exit: + kfree(fattr.cf_private); kfree(buf); cifs_put_tlink(tlink); return rc; @@ -784,6 +806,16 @@ cifs_find_inode(struct inode *inode, void *opaque) if (S_ISDIR(inode->i_mode) && !hlist_empty(&inode->i_dentry)) fattr->cf_flags |= CIFS_FATTR_INO_COLLISION; + /* looking for an inode of a alternate data stream (full pathname) */ + if (fattr->cf_flags & CIFS_FATTR_ALTDATASTR) { + if (!(inode->i_flags & S_PRIVATE)) { + return 0; + } else { + if (strcmp(inode->i_private, fattr->cf_private)) + return 0; + } + } + return 1; }