From patchwork Sun Apr 13 13:11:11 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Kinglong Mee X-Patchwork-Id: 3973891 Return-Path: X-Original-To: patchwork-linux-nfs@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id BB1F59F2CC for ; Sun, 13 Apr 2014 13:11:40 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id B709520200 for ; Sun, 13 Apr 2014 13:11:39 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id D24B8201FE for ; Sun, 13 Apr 2014 13:11:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754569AbaDMNLh (ORCPT ); Sun, 13 Apr 2014 09:11:37 -0400 Received: from mail-pb0-f54.google.com ([209.85.160.54]:55110 "EHLO mail-pb0-f54.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754557AbaDMNLg (ORCPT ); Sun, 13 Apr 2014 09:11:36 -0400 Received: by mail-pb0-f54.google.com with SMTP id ma3so7175396pbc.41 for ; Sun, 13 Apr 2014 06:11:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=message-id:date:from:user-agent:mime-version:to:subject :content-type:content-transfer-encoding; bh=ACKdwyFqIBuIzXv211P19n+j9WPciCUDw4ybmvPdk7Q=; b=XY0s5B88LnbJL2DfiUBHsbk0ilieiFuEhN+qBkeyqAfBd8krpQwzbwQFp+eG8In4Kh XQJCvr5XZXtdIGu2zspRuu319xedoPip+6hd4BYcRIvJqSUZhqHR6Re3CDmxbHjzWSx1 sIO4nbvsN3ducOPPmfKT3i+BMZ7Y9qj4Uty06EmCT7PmTfA68z60INSnIB1ojG+XZEZS V7GfxeQjsUHB++Nu9kN9ICB9+TQG5tCG6L0An1W944tTUp5cpNgLeV1ZP2XZ8tj3tIOI ys0QpTeNsAPQqQFk7SOF9a05XoQqFiIZE/5xpsqEbLYGcEJ1+texiJVdDY6ow80g+91Q VFyA== X-Received: by 10.67.24.1 with SMTP id ie1mr1317496pad.133.1397394695944; Sun, 13 Apr 2014 06:11:35 -0700 (PDT) Received: from [192.168.0.104] ([171.215.249.239]) by mx.google.com with ESMTPSA id pr4sm27626097pbb.53.2014.04.13.06.11.32 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Sun, 13 Apr 2014 06:11:34 -0700 (PDT) Message-ID: <534A8CEF.6000609@gmail.com> Date: Sun, 13 Apr 2014 21:11:11 +0800 From: Kinglong Mee User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:24.0) Gecko/20100101 Thunderbird/24.4.0 MIME-Version: 1.0 To: Trond Myklebust , linux-nfs@vger.kernel.org Subject: [PATCH] NFS: add FATTR4_WORD1_MODE flags for cache_consistency_bitmask Sender: linux-nfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org X-Spam-Status: No, score=-7.8 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, T_DKIM_INVALID, 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 After writing data at NFS client, file's access mode is inconsistent with server. Because WRITE proceduce changes the S_ISUID and S_ISGID bits, but client don't get it. #touch hello; chmod 06777 hello; stat hello; File: ‘hello’ Size: 0 Blocks: 0 IO Block: 262144 regular empty file Device: 24h/36d Inode: 786434 Links: 1 Access: (6777/-rwsrwsrwx) Uid: ( 0/ root) Gid: ( 0/ root) Context: system_u:object_r:nfs_t:s0 Access: 2014-04-13 21:00:44.996908708 +0800 Modify: 2014-04-13 21:00:44.996908708 +0800 Change: 2014-04-13 21:00:45.033908705 +0800 Birth: - #echo 12324 > hello; stat hello; stat /nfstest/hello File: ‘hello’ Size: 6 Blocks: 0 IO Block: 262144 regular file Device: 24h/36d Inode: 786434 Links: 1 Access: (6777/-rwsrwsrwx) Uid: ( 0/ root) Gid: ( 0/ root) ^^^^^ it should be 0777 Context: system_u:object_r:nfs_t:s0 Access: 2014-04-13 21:00:44.996908708 +0800 Modify: 2014-04-13 21:00:45.061908703 +0800 Change: 2014-04-13 21:00:45.061908703 +0800 Birth: - File: ‘/nfstest/hello’ Size: 6 Blocks: 8 IO Block: 4096 regular file Device: 803h/2051d Inode: 786434 Links: 1 Access: (0777/-rwxrwxrwx) Uid: ( 0/ root) Gid: ( 0/ root) ^^^^^ bits on the server Context: system_u:object_r:default_t:s0 Access: 2014-04-13 21:00:44.996908708 +0800 Modify: 2014-04-13 21:00:45.061908703 +0800 Change: 2014-04-13 21:00:45.061908703 +0800 Birth: - Signed-off-by: Kinglong Mee --- fs/nfs/nfs4proc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) + server->cache_consistency_bitmask[1] &= FATTR4_WORD1_MODE|FATTR4_WORD1_TIME_METADATA|FATTR4_WORD1_TIME_MODIFY; server->cache_consistency_bitmask[2] = 0; server->acl_bitmask = res.acl_bitmask; server->fh_expire_type = res.fh_expire_type; diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c index 397be39..f234af7 100644 --- a/fs/nfs/nfs4proc.c +++ b/fs/nfs/nfs4proc.c @@ -2819,7 +2819,7 @@ static int _nfs4_server_capabilities(struct nfs_server *server, struct nfs_fh *f memcpy(server->cache_consistency_bitmask, res.attr_bitmask, sizeof(server->cache_consistency_bitmask)); server->cache_consistency_bitmask[0] &= FATTR4_WORD0_CHANGE|FATTR4_WORD0_SIZE; - server->cache_consistency_bitmask[1] &= FATTR4_WORD1_TIME_METADATA|FATTR4_WORD1_TIME_MODIFY;