From patchwork Tue Jul 31 19:54:10 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Trond Myklebust X-Patchwork-Id: 10551303 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 6E978157D for ; Tue, 31 Jul 2018 19:54:39 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5DF572B353 for ; Tue, 31 Jul 2018 19:54:39 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 522E62B48F; Tue, 31 Jul 2018 19:54:39 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.8 required=2.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C6DEF2B353 for ; Tue, 31 Jul 2018 19:54:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732493AbeGaVga (ORCPT ); Tue, 31 Jul 2018 17:36:30 -0400 Received: from mail-io0-f193.google.com ([209.85.223.193]:34634 "EHLO mail-io0-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732372AbeGaVga (ORCPT ); Tue, 31 Jul 2018 17:36:30 -0400 Received: by mail-io0-f193.google.com with SMTP id l7-v6so14109639ioj.1 for ; Tue, 31 Jul 2018 12:54:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=n3cjef2W48LnbqLt3k4kEMcyC0g65Q/jxq8LAi7t/pQ=; b=km1h/s3koTQwHWhPY7gBdEi1xJqdQ764uH5Q0ffFoTXOyQxi8Y07YPL5a7sGZ1+OvD nsAFdoPjrsmm8CjZyjXwG8PI3j7tLsxcIqh43gWBRS2x3kfMMjG/EaF3BVQpuU322OEF IPZDN3hcaSyBxpjb+sXCUOxjdVE0aVGz1jYHz14ZmWWyjg6QAKxi9ibRaGQ5eJBKYun6 A+3zlxKI+aya9c27gCFBjOPJZKBRlE/9qwAB7JUP6OUrIN3zHgxEktW24KZo1VtaO6g+ tCCBhEv+1eW/wi6x5+5tLw1zwABpSkkWcScFQ/nFH1zOinGJmYSoeUbsmhN/Wx19t3eL aN9Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=n3cjef2W48LnbqLt3k4kEMcyC0g65Q/jxq8LAi7t/pQ=; b=ugjMoiz4auS5k9Vx0YfzfXSZJSDRRKKNPU5BKJyETpH543sm/qg+h49yymZ3ntrgxr TTbjGfCE+f+Vgz21EIrUgiXWqnFLW18RyX1UTlwcVcjt29NQ61zjODrdV4jqtV8YYWIr FHhE7IIWpf4Kr+eUI7pYuFVstSD/oTuVHtOcjxPdM6CQKULZxm7dLwQe6elOcDtT26ed X/Y27UcIMzV7bVtU2QO0pptbtvK3tT1087NmpUR2/f6B/RTwN23Uj+C7p2AvuYTnAzCu +TaQxiq0Dq74VjR5VcXOwKNmFphx9DMx+BGpYw//YPKCrKXxrV9RiBQaErjRGtXjDBL+ T1NQ== X-Gm-Message-State: AOUpUlHEOw2NYDA5sTKyV3PivMPOcyzZayAnhoRk2Rc+p+Btxx6CF53C HCarySRwmKlvEGLXZTvYqA== X-Google-Smtp-Source: AAOMgpcjKZPqEhPfT50N8heokpSQs+83tum6oGBtjJ4J6YUO0hSxzdYKLSWvpjTBXCZ1scapP0xNAQ== X-Received: by 2002:a6b:320c:: with SMTP id y12-v6mr718829ioy.127.1533066876213; Tue, 31 Jul 2018 12:54:36 -0700 (PDT) Received: from leira.trondhjem.org.localdomain (50-36-89-147.alma.mi.frontiernet.net. [50.36.89.147]) by smtp.gmail.com with ESMTPSA id x197-v6sm2147205itb.5.2018.07.31.12.54.35 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 31 Jul 2018 12:54:35 -0700 (PDT) From: Trond Myklebust X-Google-Original-From: Trond Myklebust To: Anna Schumaker Cc: linux-nfs@vger.kernel.org Subject: [PATCH v3 1/3] NFSv4: bump/drop the nlink count on the parent dir when we mkdir/rmdir Date: Tue, 31 Jul 2018 15:54:10 -0400 Message-Id: <20180731195412.10912-2-trond.myklebust@hammerspace.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180731195412.10912-1-trond.myklebust@hammerspace.com> References: <20180731195412.10912-1-trond.myklebust@hammerspace.com> MIME-Version: 1.0 Sender: linux-nfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Ensure that we always bump or drop the nlink count on the parent directory when we do a mkdir or a rmdir(). This needs to be done by hand as we don't have pre/post op attributes. Signed-off-by: Trond Myklebust --- fs/nfs/nfs4proc.c | 50 +++++++++++++++++++++++++++++++++++++++-------- 1 file changed, 42 insertions(+), 8 deletions(-) diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c index 5a8190ec31a2..1a8423ff7606 100644 --- a/fs/nfs/nfs4proc.c +++ b/fs/nfs/nfs4proc.c @@ -1071,12 +1071,26 @@ int nfs4_call_sync(struct rpc_clnt *clnt, return nfs4_call_sync_sequence(clnt, server, msg, args, res); } -static void update_changeattr(struct inode *dir, struct nfs4_change_info *cinfo, +static void +nfs4_inc_nlink_locked(struct inode *inode) +{ + NFS_I(inode)->cache_validity |= NFS_INO_INVALID_OTHER; + inc_nlink(inode); +} + +static void +nfs4_dec_nlink_locked(struct inode *inode) +{ + NFS_I(inode)->cache_validity |= NFS_INO_INVALID_OTHER; + drop_nlink(inode); +} + +static void +update_changeattr_locked(struct inode *dir, struct nfs4_change_info *cinfo, unsigned long timestamp) { struct nfs_inode *nfsi = NFS_I(dir); - spin_lock(&dir->i_lock); nfsi->cache_validity |= NFS_INO_INVALID_CTIME | NFS_INO_INVALID_MTIME | NFS_INO_INVALID_DATA; @@ -1093,6 +1107,14 @@ static void update_changeattr(struct inode *dir, struct nfs4_change_info *cinfo, nfsi->read_cache_jiffies = timestamp; nfsi->attr_gencount = nfs_inc_attr_generation_counter(); nfs_fscache_invalidate(dir); +} + +static void +update_changeattr(struct inode *dir, struct nfs4_change_info *cinfo, + unsigned long timestamp) +{ + spin_lock(&dir->i_lock); + update_changeattr_locked(dir, cinfo, timestamp); spin_unlock(&dir->i_lock); } @@ -4237,7 +4259,8 @@ nfs4_proc_create(struct inode *dir, struct dentry *dentry, struct iattr *sattr, return status; } -static int _nfs4_proc_remove(struct inode *dir, const struct qstr *name) +static int +_nfs4_proc_remove(struct inode *dir, const struct qstr *name, u32 ftype) { struct nfs_server *server = NFS_SERVER(dir); struct nfs_removeargs args = { @@ -4256,8 +4279,14 @@ static int _nfs4_proc_remove(struct inode *dir, const struct qstr *name) int status; status = nfs4_call_sync(server->client, server, &msg, &args.seq_args, &res.seq_res, 1); - if (status == 0) - update_changeattr(dir, &res.cinfo, timestamp); + if (status == 0) { + spin_lock(&dir->i_lock); + update_changeattr_locked(dir, &res.cinfo, timestamp); + /* Removing a directory decrements nlink in the parent */ + if (ftype == NF4DIR && dir->i_nlink > 2) + nfs4_dec_nlink_locked(dir); + spin_unlock(&dir->i_lock); + } return status; } @@ -4274,7 +4303,7 @@ static int nfs4_proc_remove(struct inode *dir, struct dentry *dentry) nfs4_inode_make_writeable(inode); } do { - err = _nfs4_proc_remove(dir, &dentry->d_name); + err = _nfs4_proc_remove(dir, &dentry->d_name, NF4REG); trace_nfs4_remove(dir, &dentry->d_name, err); err = nfs4_handle_exception(NFS_SERVER(dir), err, &exception); @@ -4288,7 +4317,7 @@ static int nfs4_proc_rmdir(struct inode *dir, const struct qstr *name) int err; do { - err = _nfs4_proc_remove(dir, name); + err = _nfs4_proc_remove(dir, name, NF4DIR); trace_nfs4_remove(dir, name, err); err = nfs4_handle_exception(NFS_SERVER(dir), err, &exception); @@ -4492,8 +4521,13 @@ static int nfs4_do_create(struct inode *dir, struct dentry *dentry, struct nfs4_ int status = nfs4_call_sync(NFS_SERVER(dir)->client, NFS_SERVER(dir), &data->msg, &data->arg.seq_args, &data->res.seq_res, 1); if (status == 0) { - update_changeattr(dir, &data->res.dir_cinfo, + spin_lock(&dir->i_lock); + update_changeattr_locked(dir, &data->res.dir_cinfo, data->res.fattr->time_start); + /* Creating a directory bumps nlink in the parent */ + if (data->arg.ftype == NF4DIR) + nfs4_inc_nlink_locked(dir); + spin_unlock(&dir->i_lock); status = nfs_instantiate(dentry, data->res.fh, data->res.fattr, data->res.label); } return status; From patchwork Tue Jul 31 19:54:11 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Trond Myklebust X-Patchwork-Id: 10551305 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 4FE27157D for ; Tue, 31 Jul 2018 19:54:41 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 40EEA2B353 for ; Tue, 31 Jul 2018 19:54:41 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 3555D2B496; Tue, 31 Jul 2018 19:54:41 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.8 required=2.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0D2D82B353 for ; Tue, 31 Jul 2018 19:54:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732525AbeGaVgc (ORCPT ); Tue, 31 Jul 2018 17:36:32 -0400 Received: from mail-io0-f194.google.com ([209.85.223.194]:39833 "EHLO mail-io0-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732372AbeGaVgb (ORCPT ); Tue, 31 Jul 2018 17:36:31 -0400 Received: by mail-io0-f194.google.com with SMTP id o22-v6so14087298ioh.6 for ; Tue, 31 Jul 2018 12:54:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=s0O1lP0JP33FuaoOE9sDislUzMOXAYHykGvg3hAgvx4=; b=GFoMlnwAqZ4DkB0olA7LqTG6NtIquPGYrCcFWTlnA12Fbn8Vy178OaXvUkSY2g1ujJ FU1A7aptAEOeIy86f/wyrTQsRyzkwkZ+ZaogYSHA9FxLntuQdyv1UrUgkDocrVCXxNT3 3zABJmiA8if4xJQ2/ixgI61D5ohKSrD+u+Yko9ew5egOBjqfmxUqr66yfau7aL3RwIZ4 vFtXETBM1GUjP59ETrvQpIHe+4qy0jFsZVvpqG9wKfV7jfYHOcjdED2fC4lO8/tqimZe fL2xQ659QhPwQ2Gsgmd698exXnEWxw/Q0omFLtFyaJRhoTXt/ewKKEoeoMSxCyMEBuSS hykQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=s0O1lP0JP33FuaoOE9sDislUzMOXAYHykGvg3hAgvx4=; b=l58Mx+HIn9nkmYDQjVwv6dHidhIMpp4LsBluAwLnPPsDWCVdGTU6C9ZWGZ9OZlMGNw uMHGKWmc9KloSF2yc5DnBYj/7tCZGvnsH85HrV6QSWrx/+3l+CFQUwbpTwuDh9p7teTh PTvjf9OgYJ9LVw8/RZqql9++Gm+HrVgQdLZJeK8ihazeMTYq2IhMpNnakkRbM5Nvvwn/ hmCDV982KFHdPhrDt1luPO2VCNH1b+f2hNtI3wCz0Tbg7Su0qlzSyBWhAmrB6wVNj708 VPAUZxvtgORyDnVzz9BGJzXv+S8p1KYy8kiXd09O1NFtQRXiF15Quw9mGB4O88R237hE oulA== X-Gm-Message-State: AOUpUlEIPIIatHAw4LpJUM3ap4nb8tykCDR1Vz7RyfM0aSi/U+h4nVMF KRj7DJoeUN6/TZq8cv5PDY92XOY= X-Google-Smtp-Source: AAOMgpcrLPRxrpMHkFevq2CQ1R021TmYAPascMSX2j+AI0XQlN1LOGcfANU1uqoTUWwVXEu8ta72eg== X-Received: by 2002:a6b:28c2:: with SMTP id o185-v6mr948926ioo.109.1533066877259; Tue, 31 Jul 2018 12:54:37 -0700 (PDT) Received: from leira.trondhjem.org.localdomain (50-36-89-147.alma.mi.frontiernet.net. [50.36.89.147]) by smtp.gmail.com with ESMTPSA id x197-v6sm2147205itb.5.2018.07.31.12.54.36 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 31 Jul 2018 12:54:36 -0700 (PDT) From: Trond Myklebust X-Google-Original-From: Trond Myklebust To: Anna Schumaker Cc: linux-nfs@vger.kernel.org Subject: [PATCH v3 2/3] NFSv4: Detect nlink changes on cross-directory renames too Date: Tue, 31 Jul 2018 15:54:11 -0400 Message-Id: <20180731195412.10912-3-trond.myklebust@hammerspace.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180731195412.10912-2-trond.myklebust@hammerspace.com> References: <20180731195412.10912-1-trond.myklebust@hammerspace.com> <20180731195412.10912-2-trond.myklebust@hammerspace.com> MIME-Version: 1.0 Sender: linux-nfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP If the object being renamed from one directory to another is also a directory, then 'nlink' will change for both directories. Signed-off-by: Trond Myklebust --- fs/nfs/nfs4proc.c | 35 +++++++++++++++++++++++------------ 1 file changed, 23 insertions(+), 12 deletions(-) diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c index 1a8423ff7606..2f07a31e2fb6 100644 --- a/fs/nfs/nfs4proc.c +++ b/fs/nfs/nfs4proc.c @@ -1087,13 +1087,14 @@ nfs4_dec_nlink_locked(struct inode *inode) static void update_changeattr_locked(struct inode *dir, struct nfs4_change_info *cinfo, - unsigned long timestamp) + unsigned long timestamp, unsigned long cache_validity) { struct nfs_inode *nfsi = NFS_I(dir); nfsi->cache_validity |= NFS_INO_INVALID_CTIME | NFS_INO_INVALID_MTIME - | NFS_INO_INVALID_DATA; + | NFS_INO_INVALID_DATA + | cache_validity; if (cinfo->atomic && cinfo->before == inode_peek_iversion_raw(dir)) { nfsi->cache_validity &= ~NFS_INO_REVAL_PAGECACHE; nfsi->attrtimeo_timestamp = jiffies; @@ -1111,10 +1112,10 @@ update_changeattr_locked(struct inode *dir, struct nfs4_change_info *cinfo, static void update_changeattr(struct inode *dir, struct nfs4_change_info *cinfo, - unsigned long timestamp) + unsigned long timestamp, unsigned long cache_validity) { spin_lock(&dir->i_lock); - update_changeattr_locked(dir, cinfo, timestamp); + update_changeattr_locked(dir, cinfo, timestamp, cache_validity); spin_unlock(&dir->i_lock); } @@ -2503,7 +2504,7 @@ static int _nfs4_proc_open(struct nfs4_opendata *data, if (data->file_created || inode_peek_iversion_raw(dir) != o_res->cinfo.after) update_changeattr(dir, &o_res->cinfo, - o_res->f_attr->time_start); + o_res->f_attr->time_start, 0); } if ((o_res->rflags & NFS4_OPEN_RESULT_LOCKTYPE_POSIX) == 0) server->caps &= ~NFS_CAP_POSIX_LOCK; @@ -4281,7 +4282,7 @@ _nfs4_proc_remove(struct inode *dir, const struct qstr *name, u32 ftype) status = nfs4_call_sync(server->client, server, &msg, &args.seq_args, &res.seq_res, 1); if (status == 0) { spin_lock(&dir->i_lock); - update_changeattr_locked(dir, &res.cinfo, timestamp); + update_changeattr_locked(dir, &res.cinfo, timestamp, 0); /* Removing a directory decrements nlink in the parent */ if (ftype == NF4DIR && dir->i_nlink > 2) nfs4_dec_nlink_locked(dir); @@ -4361,7 +4362,8 @@ static int nfs4_proc_unlink_done(struct rpc_task *task, struct inode *dir) &data->timeout) == -EAGAIN) return 0; if (task->tk_status == 0) - update_changeattr(dir, &res->cinfo, res->dir_attr->time_start); + update_changeattr(dir, &res->cinfo, + res->dir_attr->time_start, 0); return 1; } @@ -4403,9 +4405,18 @@ static int nfs4_proc_rename_done(struct rpc_task *task, struct inode *old_dir, return 0; if (task->tk_status == 0) { - update_changeattr(old_dir, &res->old_cinfo, res->old_fattr->time_start); - if (new_dir != old_dir) - update_changeattr(new_dir, &res->new_cinfo, res->new_fattr->time_start); + if (new_dir != old_dir) { + /* Note: If we moved a directory, nlink will change */ + update_changeattr(old_dir, &res->old_cinfo, + res->old_fattr->time_start, + NFS_INO_INVALID_OTHER); + update_changeattr(new_dir, &res->new_cinfo, + res->new_fattr->time_start, + NFS_INO_INVALID_OTHER); + } else + update_changeattr(old_dir, &res->old_cinfo, + res->old_fattr->time_start, + 0); } return 1; } @@ -4446,7 +4457,7 @@ static int _nfs4_proc_link(struct inode *inode, struct inode *dir, const struct status = nfs4_call_sync(server->client, server, &msg, &arg.seq_args, &res.seq_res, 1); if (!status) { - update_changeattr(dir, &res.cinfo, res.fattr->time_start); + update_changeattr(dir, &res.cinfo, res.fattr->time_start, 0); status = nfs_post_op_update_inode(inode, res.fattr); if (!status) nfs_setsecurity(inode, res.fattr, res.label); @@ -4523,7 +4534,7 @@ static int nfs4_do_create(struct inode *dir, struct dentry *dentry, struct nfs4_ if (status == 0) { spin_lock(&dir->i_lock); update_changeattr_locked(dir, &data->res.dir_cinfo, - data->res.fattr->time_start); + data->res.fattr->time_start, 0); /* Creating a directory bumps nlink in the parent */ if (data->arg.ftype == NF4DIR) nfs4_inc_nlink_locked(dir); From patchwork Tue Jul 31 19:54:12 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Trond Myklebust X-Patchwork-Id: 10551307 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 93E521822 for ; Tue, 31 Jul 2018 19:54:41 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 858AC2B353 for ; Tue, 31 Jul 2018 19:54:41 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 79B882B48F; Tue, 31 Jul 2018 19:54:41 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.8 required=2.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6F8CF2B431 for ; Tue, 31 Jul 2018 19:54:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732458AbeGaVgc (ORCPT ); Tue, 31 Jul 2018 17:36:32 -0400 Received: from mail-io0-f176.google.com ([209.85.223.176]:45777 "EHLO mail-io0-f176.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732372AbeGaVgc (ORCPT ); Tue, 31 Jul 2018 17:36:32 -0400 Received: by mail-io0-f176.google.com with SMTP id k16-v6so14085738iom.12 for ; Tue, 31 Jul 2018 12:54:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=6+qrIzPCCMw6yBRALXbL2owiwbyaf2sBaEai21Tosnc=; b=DhCb+hwenfxCDzGqlCMSPHNQJ/0Y/bSrrBkEvS8yMHKZ3DyU/oyeyZp0vQELNF0DIi /KrBgB5khmKur62WhkO/siKMfZygryItM9sTsTfQ7m6Ek1MeWsbuTgG+3Cid8bGd3eyF 3LlufmMrDdOlj2nngZbN6xnx+2jbdI1T8ejEroXTltSCWl/LR+MB4+9KrlX06LTeaKEx JxQzULhPy2S2fm6ggvCrpLH2jb8b0X4rvdo17hvOqJjzobugNp+F4MCQ9ANmQpgxE10O 92gwUQmfFMt/LZ1k5kduyWY/Vh9OyxoRHFRgEjCemg31ZLP7/fpEQ6lv9E96gqZq65bw q2SA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=6+qrIzPCCMw6yBRALXbL2owiwbyaf2sBaEai21Tosnc=; b=htV9Zs/kvGIrU/CKzh8g6oQ3jy6qI7Za2I9eUdiZ3BhvmsIyVQALxUYSazKEQNr8fd 9RsGRa/t2ydRyrES/3mZJzzM14oQUbWHMqxVmbRj4DXDKdVcgUKYVLKfZaBYKo9sTQiU nT4e0Ku3v4mUGCsnHO/YQknwiQu4GfFNxCVoQ/9jpde4IoRm7toyyao7gMqbouOW5ydW YRTHLJ/nf1vdR9dy6mChGt03WIC8Ju8olm3yScHyxL5nQ6ODD87FObmYWtwIR3bRhwaR /LSaVjor+aWs3B2eBKcUq5hjnijbZW8mF/Z+sMTejJVg7G6drGw3a1G9PMhilUxJiXrq HUPQ== X-Gm-Message-State: AOUpUlEhPnQxXx8Wr57ecdsP5nA0hOC7g73rEULGxFqNfLumqPnBgm/O q3DPDx2OaDK3r9C9rrty1RxSfpc= X-Google-Smtp-Source: AAOMgpdyseRzeneHgB5XI86/nVy9JHXDAdR8a8BYxRs95b07aqoxfqnYoz8XneHHSrt9Jkgw1e0TFQ== X-Received: by 2002:a6b:d014:: with SMTP id x20-v6mr899271ioa.181.1533066878535; Tue, 31 Jul 2018 12:54:38 -0700 (PDT) Received: from leira.trondhjem.org.localdomain (50-36-89-147.alma.mi.frontiernet.net. [50.36.89.147]) by smtp.gmail.com with ESMTPSA id x197-v6sm2147205itb.5.2018.07.31.12.54.37 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 31 Jul 2018 12:54:37 -0700 (PDT) From: Trond Myklebust X-Google-Original-From: Trond Myklebust To: Anna Schumaker Cc: linux-nfs@vger.kernel.org Subject: [PATCH v3 3/3] NFSv4: Mark the inode change attribute up to date in update_changeattr() Date: Tue, 31 Jul 2018 15:54:12 -0400 Message-Id: <20180731195412.10912-4-trond.myklebust@hammerspace.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180731195412.10912-3-trond.myklebust@hammerspace.com> References: <20180731195412.10912-1-trond.myklebust@hammerspace.com> <20180731195412.10912-2-trond.myklebust@hammerspace.com> <20180731195412.10912-3-trond.myklebust@hammerspace.com> MIME-Version: 1.0 Sender: linux-nfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP When we update the change attribute, we should also clear the flag that says it is out of date. Signed-off-by: Trond Myklebust --- fs/nfs/nfs4proc.c | 1 + 1 file changed, 1 insertion(+) diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c index 2f07a31e2fb6..a8617fa865e5 100644 --- a/fs/nfs/nfs4proc.c +++ b/fs/nfs/nfs4proc.c @@ -1107,6 +1107,7 @@ update_changeattr_locked(struct inode *dir, struct nfs4_change_info *cinfo, inode_set_iversion_raw(dir, cinfo->after); nfsi->read_cache_jiffies = timestamp; nfsi->attr_gencount = nfs_inc_attr_generation_counter(); + nfsi->cache_validity &= ~NFS_INO_INVALID_CHANGE; nfs_fscache_invalidate(dir); }