From patchwork Tue Jul 31 17:24:24 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Trond Myklebust X-Patchwork-Id: 10551103 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 303AD96FA for ; Tue, 31 Jul 2018 17:24:52 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 12C982A3F8 for ; Tue, 31 Jul 2018 17:24:52 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 0669D2AC81; Tue, 31 Jul 2018 17:24:52 +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 86C8C2A557 for ; Tue, 31 Jul 2018 17:24:51 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729634AbeGaTGI (ORCPT ); Tue, 31 Jul 2018 15:06:08 -0400 Received: from mail-it0-f65.google.com ([209.85.214.65]:36809 "EHLO mail-it0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727999AbeGaTGI (ORCPT ); Tue, 31 Jul 2018 15:06:08 -0400 Received: by mail-it0-f65.google.com with SMTP id p81-v6so5468872itp.1 for ; Tue, 31 Jul 2018 10:24:49 -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=liY6Khr8JxH+2P+2NAWsG7aH7lEfcNRudjIIZXhw/SA=; b=ShZA/ELRxTEZtkeL/DHc4GYaEjzbKeCe5uHbHPsz6D2i7wfUxFSJ2k8Xe1bvj5jWpn eNVn0bNpHBRfTFZnQmgC2jhdI4jUfoQA6SfT+hrDgt0F5fyEWOFYCDMM8CIdgk1WNKXH nXg/Cwdd4sw35ryoVOV++hGxy02flh5DV9RTbFPwZrDz+A6SBPevz6OCV9jR9ApwCYiJ MBoHV4gUCgaPIejaYKlM85/mLxTdhIoPjy3N1cjfprGZdUOZ/5GN2smz+wIfZMnKg0vk KiyZuWyt0etfwzn5G4TdI0Z14+fbYIqROfuagV+43pDoX62U/sUOKXSSYh1duQUnYE4S qZfw== 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=liY6Khr8JxH+2P+2NAWsG7aH7lEfcNRudjIIZXhw/SA=; b=Fp/ZhRYTb1peNJl99iXVYCuj0O7wGSo/pNdfZjIjVh8B76lBi6X55aWGGMqJ6MoxKz ijkWx2ggFOwQbp5miVtQqGFelPvTXW7KOL0pczw9atyUnoajiHwTNn4a3fJUW7iAW4cK g/Z9KNBEH2biQUiIwhtgiRIHeGl1V2vNBHuMpJzduMNwaishj258b0gvIpJ+c/w0NNHf gaAmBkiCWqHjvo4FCYmkC8/2T/2cz1kxlMqs50zcGdjtS1HA/rMafpDFXKvtyD2ryT5J YSjErR0FdWxuHADcgIXg0qBgTr5qEiqQXJjyBpQTPKMvSDwyTtuhzDevKXX5YF01pCC7 8UMw== X-Gm-Message-State: AOUpUlGgvJlUp+kPeSScPQ+DTAQo1ShrxvZUZddoo4lLTHZODTdcWW+W LsWeRItCWF2f5EByC3G4JD+9CTM= X-Google-Smtp-Source: AAOMgpcj8dKjtVEZoV1liHbswyJmZEJ+sJX5cE35jSc7O/Z+gKHM2QsXmOokr7u3wGeyxnfbOa9tdw== X-Received: by 2002:a24:b842:: with SMTP id m63-v6mr561146ite.31.1533057889430; Tue, 31 Jul 2018 10:24:49 -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 b15-v6sm1751038itb.25.2018.07.31.10.24.48 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 31 Jul 2018 10:24:48 -0700 (PDT) From: Trond Myklebust X-Google-Original-From: Trond Myklebust To: Anna Schumaker Cc: linux-nfs@vger.kernel.org Subject: [PATCH v2 1/3] NFSv4: bump/drop the nlink count on the parent dir when we mkdir/rmdir Date: Tue, 31 Jul 2018 13:24:24 -0400 Message-Id: <20180731172426.6491-2-trond.myklebust@hammerspace.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180731172426.6491-1-trond.myklebust@hammerspace.com> References: <20180731172426.6491-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..0d56d3662005 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; + dec_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 17:24:25 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Trond Myklebust X-Patchwork-Id: 10551105 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 3E21B157D for ; Tue, 31 Jul 2018 17:24:53 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 20F542A557 for ; Tue, 31 Jul 2018 17:24:53 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 157FB2AC81; Tue, 31 Jul 2018 17:24:53 +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 8D9302A3F8 for ; Tue, 31 Jul 2018 17:24:52 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728800AbeGaTGJ (ORCPT ); Tue, 31 Jul 2018 15:06:09 -0400 Received: from mail-io0-f177.google.com ([209.85.223.177]:40066 "EHLO mail-io0-f177.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729622AbeGaTGJ (ORCPT ); Tue, 31 Jul 2018 15:06:09 -0400 Received: by mail-io0-f177.google.com with SMTP id l14-v6so13684631iob.7 for ; Tue, 31 Jul 2018 10:24:50 -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=qqmrofX0JSryT1wrHtuC8y0YtTVGNGyu1RRc//oIdSw=; b=cHyNdKCTr/fC2DFnXZbrOEqzmZstm84LEX/l0bA7JbAvd0uLpx1WT0o4g5WTyDFb6u icgGetqxWF4POAHZ72+n+gJFFwYoOGiWjmq8tBr8WbGRNQqm69IqK6Z9KL3ApDkyPINX gF2zUXeSaTAxSCGkBqLbkymHOLc1tbHLGOePoOOq7XkA7HN9aH5/nT+dWZ9sT944rqVI 4+owgyOT3Y6vREDRi3AAw1afAP7yVYE17Noncjue+jEIak/3U/dqQo5rdhjoY7D60bmj 7VuOLyWoyw0i26B1vDgOovYmIjZSJZcSo3oDDSk6IQDTj6f3iewCmLxkXUQ4ni9GGvOd 3gRQ== 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=qqmrofX0JSryT1wrHtuC8y0YtTVGNGyu1RRc//oIdSw=; b=rtJ1tYCMkzCsrx/EpwqRfi5mc/zWRci0vpGzg0RzjqQwbduYIRYbRqPLY+c6oGuVe3 cII/gam9lhKpFlYkZzBz2qEydwlGnf4OzEhAR9eDOt2Q+EW+fokOYFzbq6XxjnwBao1a W7nKX44+5oub0ByXDACMAEsOIYBD1/mrNv+ncIvlDRW7bdZ6hemgjNadgRmWlhhz1l0H hWxslhZMz+QUh/Cbpt7wXAuODw1IUxZmodB8WBPtQJ/3hRJ6ETCinqoMBP6LTK4bzSdC eF4cZW4b9usfDbPHAMx/kw/KhuWC1ZGspWb7oMMdYJmx4UXZ/6/HUE6+FSomcIA6uEzW 8Szg== X-Gm-Message-State: AOUpUlFtkL/5pukIHykTmKuR6OZeOcQ+bTwxxaN/6n+1r4nKG2hOVK4h YX/vRy9OM8kOxwAYcu4ZYg== X-Google-Smtp-Source: AAOMgpcntqv/qHZMdDADDiPlzD3Ew419ZK1LNeWiyiNhnc8cNsLyoIg82H8S8cm8S404B0ui7hXW3w== X-Received: by 2002:a6b:6410:: with SMTP id t16-v6mr542915iog.11.1533057890393; Tue, 31 Jul 2018 10:24:50 -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 b15-v6sm1751038itb.25.2018.07.31.10.24.49 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 31 Jul 2018 10:24:49 -0700 (PDT) From: Trond Myklebust X-Google-Original-From: Trond Myklebust To: Anna Schumaker Cc: linux-nfs@vger.kernel.org Subject: [PATCH v2 2/3] NFSv4: Detect nlink changes on cross-directory renames too Date: Tue, 31 Jul 2018 13:24:25 -0400 Message-Id: <20180731172426.6491-3-trond.myklebust@hammerspace.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180731172426.6491-2-trond.myklebust@hammerspace.com> References: <20180731172426.6491-1-trond.myklebust@hammerspace.com> <20180731172426.6491-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 0d56d3662005..9d181d76c744 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 17:24:26 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Trond Myklebust X-Patchwork-Id: 10551107 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 605FB15E2 for ; Tue, 31 Jul 2018 17:24:54 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 439B52A3F8 for ; Tue, 31 Jul 2018 17:24:54 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 37CF62AC81; Tue, 31 Jul 2018 17:24:54 +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 1A2A52A3F8 for ; Tue, 31 Jul 2018 17:24:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729622AbeGaTGK (ORCPT ); Tue, 31 Jul 2018 15:06:10 -0400 Received: from mail-it0-f42.google.com ([209.85.214.42]:33747 "EHLO mail-it0-f42.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727999AbeGaTGK (ORCPT ); Tue, 31 Jul 2018 15:06:10 -0400 Received: by mail-it0-f42.google.com with SMTP id d16-v6so13016886itj.0 for ; Tue, 31 Jul 2018 10:24:51 -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=BFp2m7vheij4351/HUpE463JD3rhLIj0ETKN7UWHAS4=; b=O6hfcPSH835G+GkOkcwJDrcY0wnVxKM+vOZN5TJeLvcdUovZE/cfhgoaiWQFGWrHI0 KMWVfDzrBISuN/FJogDsU/e03/7e7SudkW+mugo0/bIevFMS1P0u2M0d82HHduF+/FYn n5Lq7ylgJ/RPtMKX6R1dBdymYmpatQNW/c5yi8yrg7dpauKeuKfCXT18BlMDl1phtsFQ IQOrnR4X+qcmuOwWsJnJEi1bp6fJ3jb2VylVoHt4mdW+Zm3IrsDGrsNkB+wSLdBQVyUj eaSH4FwffInnDY8BF5thr/4FlDJQoVJN4vyhwbbCD60VUCVyzmPuXelPq0A+FZn3IhGZ IgAA== 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=BFp2m7vheij4351/HUpE463JD3rhLIj0ETKN7UWHAS4=; b=pzwk6+7marj1wpNRVMFRMFlQcJiRaUG45eftrB7uX+/oSyIJyqKVPuPJ0041Z5WGti FLpV8P8V6insXAaTz+39BUlc1E6kcoLA8UQbuMQg9rZWBcPEzozEx5hh+uVmsXOB9EVk UVrmRP08A0BXCxORfppxpwvTMFKPJpRd+LE+Du16L3vUav27YVl9kJa7rPcTKLB0jMHX y6Nsv/GPGdPLsaDfbRSDXNoFaNrDdbBbUhMdb1IEB9Y8qpR8jyP8PbN9WFnJjSdklF+I GOymfDlFITj/fZt4eDPTkH6zh7Jna8ls7ClDHka1Jg90HwcyrfLyjsHeJYNp3LR+DD7h g9RA== X-Gm-Message-State: AOUpUlFPtnVjjZtxOvkhUvdonE/pQWav1Gi19JXuzd44SxO3DAWKJ5cz PzKz18/hS7K2vDTqA4UaMg== X-Google-Smtp-Source: AAOMgpf0ucNomlTIkt5CsijrqDvOCjbvsYroSKoR1b5FJLTn3uo0WLFPlYrxus+TfxBp11zLC91doQ== X-Received: by 2002:a02:b5ce:: with SMTP id y14-v6mr21278080jaj.128.1533057891311; Tue, 31 Jul 2018 10:24:51 -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 b15-v6sm1751038itb.25.2018.07.31.10.24.50 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 31 Jul 2018 10:24:50 -0700 (PDT) From: Trond Myklebust X-Google-Original-From: Trond Myklebust To: Anna Schumaker Cc: linux-nfs@vger.kernel.org Subject: [PATCH v2 3/3] NFSv4: Mark the inode change attribute up to date in update_changeattr() Date: Tue, 31 Jul 2018 13:24:26 -0400 Message-Id: <20180731172426.6491-4-trond.myklebust@hammerspace.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180731172426.6491-3-trond.myklebust@hammerspace.com> References: <20180731172426.6491-1-trond.myklebust@hammerspace.com> <20180731172426.6491-2-trond.myklebust@hammerspace.com> <20180731172426.6491-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 9d181d76c744..a1faeb2de954 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); }