From patchwork Sun Sep 16 03:05:47 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shirish Pargaonkar X-Patchwork-Id: 1462621 Return-Path: X-Original-To: patchwork-cifs-client@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork2.kernel.org (Postfix) with ESMTP id EC2FCDF264 for ; Sun, 16 Sep 2012 02:54:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1750841Ab2IPCyt (ORCPT ); Sat, 15 Sep 2012 22:54:49 -0400 Received: from mail-oa0-f46.google.com ([209.85.219.46]:65031 "EHLO mail-oa0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750740Ab2IPCys (ORCPT ); Sat, 15 Sep 2012 22:54:48 -0400 Received: by oago6 with SMTP id o6so3862744oag.19 for ; Sat, 15 Sep 2012 19:54:48 -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=+nzm9M3id+aV7lQPdgRwYbg0dQWMGpURV//EX1gSGuo=; b=Qr4Pi+FEKhACYNt/fSBFkEFUD41AheCFzeZO7fZYE8aDh0EX7nKjNlyaCV7ROEE0tT qGOX7nezOuj9E/f23fMgmgqjS87nLjsb8zhmFe7+6Kv1X4YvG+n7kePDcJlFZAhfHmhy ZL2cpQqSA9bP8YHRr4NiKVzgaZWfzSov9wOz/+1Rp/mJ9Qd8/ZHr/exIkFr0hLev55aa kdogGY8XssLOWJdfKGV55yVIXe8WHZa/KkN6c6vJ1gtYBwfzm0Xi52MeuUGQrhwF758+ Uvp3PpJiVnVz7OCZamqMPyBCDNElGEaSrXYEmQ/GfXJb0j/MLhqREJDEk5+Y5F25y/FI 1Jcw== Received: by 10.60.7.230 with SMTP id m6mr8391682oea.41.1347764088165; Sat, 15 Sep 2012 19:54:48 -0700 (PDT) Received: from localhost ([32.97.110.50]) by mx.google.com with ESMTPS id ue9sm2582927obb.10.2012.09.15.19.54.46 (version=TLSv1/SSLv3 cipher=OTHER); Sat, 15 Sep 2012 19:54:47 -0700 (PDT) From: shirishpargaonkar@gmail.com To: smfrench@gmail.com Cc: linux-cifs@vger.kernel.org, tugosavi@in.ibm.com, Shirish Pargaonkar Subject: [PATCH V2] cifs: Add support of Alternate Data Streams Date: Sat, 15 Sep 2012 22:05:47 -0500 Message-Id: <1347764747-16822-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 From: Shirish Pargaonkar Add support of Alternate Data Streams (ads). The generic access flags that cifs client currently employs are sufficient for alternate data streams as well (MS-CIFS 2.2.4.64.1). The ads files have a : in the name, so that is used to differentiate between a regular file and its alternate data streams as they have the same file id. This scheme applies to non-posix compliant servers such as Windows only. One operation that does not work is Rename (0x7). Signed-off-by: Shirish Pargaonkar --- fs/cifs/inode.c | 9 +++++++++ 1 files changed, 9 insertions(+), 0 deletions(-) diff --git a/fs/cifs/inode.c b/fs/cifs/inode.c index cb79c7e..a28950a 100644 --- a/fs/cifs/inode.c +++ b/fs/cifs/inode.c @@ -709,10 +709,15 @@ cifs_get_inode_info(struct inode **inode, const char *full_path, cFYI(1, "CIFSCheckMFSymlink: %d", tmprc); } + if (strstr(full_path, ":")) + fattr.cf_flags |= S_PRIVATE; + if (!*inode) { *inode = cifs_iget(sb, &fattr); if (!*inode) rc = -ENOMEM; + else + (*inode)->i_flags |= fattr.cf_flags; } else { cifs_fattr_to_inode(*inode, &fattr); } @@ -744,6 +749,10 @@ cifs_find_inode(struct inode *inode, void *opaque) if ((inode->i_mode & S_IFMT) != (fattr->cf_mode & S_IFMT)) return 0; + /* don't match inode with different flags */ + if ((inode->i_flags & S_PRIVATE) != (fattr->cf_flags & S_PRIVATE)) + return 0; + /* if it's not a directory or has no dentries, then flag it */ if (S_ISDIR(inode->i_mode) && !hlist_empty(&inode->i_dentry)) fattr->cf_flags |= CIFS_FATTR_INO_COLLISION;