From: Greg KH <gregkh@suse.de>
To: linux-kernel@vger.kernel.org, stable@kernel.org
Cc: stable-review@kernel.org, torvalds@linux-foundation.org,
akpm@linux-foundation.org, alan@lxorguk.ukuu.org.uk,
Trond Myklebust <Trond.Myklebust@netapp.com>
Subject: [08/43] NFS: nfs_wcc_update_inode() should set nfsi->attr_gencount
Date: Thu, 05 May 2011 17:25:29 -0700 [thread overview]
Message-ID: <20110506002608.083192247@clark.kroah.org> (raw)
In-Reply-To: <20110506002625.GA20426@kroah.com>
2.6.33-longterm review patch. If anyone has any objections, please let us know.
------------------
From: Trond Myklebust <Trond.Myklebust@netapp.com>
commit 27dc1cd3ad9300f81e1219e5fc305d91d85353f8 upstream.
If the call to nfs_wcc_update_inode() results in an attribute update, we
need to ensure that the inode's attr_gencount gets bumped too, otherwise
we are not protected against races with other GETATTR calls.
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
---
fs/nfs/inode.c | 26 +++++++++++++++++---------
1 file changed, 17 insertions(+), 9 deletions(-)
--- a/fs/nfs/inode.c
+++ b/fs/nfs/inode.c
@@ -861,9 +861,10 @@ out:
return ret;
}
-static void nfs_wcc_update_inode(struct inode *inode, struct nfs_fattr *fattr)
+static unsigned long nfs_wcc_update_inode(struct inode *inode, struct nfs_fattr *fattr)
{
struct nfs_inode *nfsi = NFS_I(inode);
+ unsigned long ret = 0;
if ((fattr->valid & NFS_ATTR_FATTR_PRECHANGE)
&& (fattr->valid & NFS_ATTR_FATTR_CHANGE)
@@ -871,25 +872,32 @@ static void nfs_wcc_update_inode(struct
nfsi->change_attr = fattr->change_attr;
if (S_ISDIR(inode->i_mode))
nfsi->cache_validity |= NFS_INO_INVALID_DATA;
+ ret |= NFS_INO_INVALID_ATTR;
}
/* If we have atomic WCC data, we may update some attributes */
if ((fattr->valid & NFS_ATTR_FATTR_PRECTIME)
&& (fattr->valid & NFS_ATTR_FATTR_CTIME)
- && timespec_equal(&inode->i_ctime, &fattr->pre_ctime))
- memcpy(&inode->i_ctime, &fattr->ctime, sizeof(inode->i_ctime));
+ && timespec_equal(&inode->i_ctime, &fattr->pre_ctime)) {
+ memcpy(&inode->i_ctime, &fattr->ctime, sizeof(inode->i_ctime));
+ ret |= NFS_INO_INVALID_ATTR;
+ }
if ((fattr->valid & NFS_ATTR_FATTR_PREMTIME)
&& (fattr->valid & NFS_ATTR_FATTR_MTIME)
&& timespec_equal(&inode->i_mtime, &fattr->pre_mtime)) {
- memcpy(&inode->i_mtime, &fattr->mtime, sizeof(inode->i_mtime));
- if (S_ISDIR(inode->i_mode))
- nfsi->cache_validity |= NFS_INO_INVALID_DATA;
+ memcpy(&inode->i_mtime, &fattr->mtime, sizeof(inode->i_mtime));
+ if (S_ISDIR(inode->i_mode))
+ nfsi->cache_validity |= NFS_INO_INVALID_DATA;
+ ret |= NFS_INO_INVALID_ATTR;
}
if ((fattr->valid & NFS_ATTR_FATTR_PRESIZE)
&& (fattr->valid & NFS_ATTR_FATTR_SIZE)
&& i_size_read(inode) == nfs_size_to_loff_t(fattr->pre_size)
- && nfsi->npages == 0)
- i_size_write(inode, nfs_size_to_loff_t(fattr->size));
+ && nfsi->npages == 0) {
+ i_size_write(inode, nfs_size_to_loff_t(fattr->size));
+ ret |= NFS_INO_INVALID_ATTR;
+ }
+ return ret;
}
/**
@@ -1183,7 +1191,7 @@ static int nfs_update_inode(struct inode
| NFS_INO_REVAL_PAGECACHE);
/* Do atomic weak cache consistency updates */
- nfs_wcc_update_inode(inode, fattr);
+ invalid |= nfs_wcc_update_inode(inode, fattr);
/* More cache consistency checks */
if (fattr->valid & NFS_ATTR_FATTR_CHANGE) {
next prev parent reply other threads:[~2011-05-06 0:27 UTC|newest]
Thread overview: 44+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-05-06 0:26 [00/43] 2.6.33.13-longterm review Greg KH
2011-05-06 0:25 ` [01/43] ath: add missing regdomain pair 0x5c mapping Greg KH
2011-05-06 0:25 ` [02/43] block, blk-sysfs: Fix an err return path in blk_register_queue() Greg KH
2011-05-06 0:25 ` [03/43] p54: Initialize extra_len in p54_tx_80211 Greg KH
2011-05-06 0:25 ` [04/43] x86, gart: Make sure GART does not map physmem above 1TB Greg KH
2011-05-06 0:25 ` [05/43] intel-iommu: Unlink domain from iommu Greg KH
2011-05-06 0:25 ` [06/43] intel-iommu: Fix get_domain_for_dev() error path Greg KH
2011-05-06 0:25 ` [07/43] drm/radeon/kms: fix bad shift in atom iio table parser Greg KH
2011-05-06 0:25 ` Greg KH [this message]
2011-05-06 0:25 ` [09/43] serial/imx: read cts state only after acking cts change irq Greg KH
2011-05-06 0:25 ` [10/43] ASoC: Fix output PGA enabling in wm_hubs CODECs Greg KH
2011-05-06 0:25 ` [11/43] kconfig: Avoid buffer underrun in choice input Greg KH
2011-05-06 0:25 ` [12/43] UBIFS: fix master node recovery Greg KH
2011-05-06 0:25 ` [13/43] Remove extra struct page member from the buffer info structure Greg KH
2011-05-06 0:25 ` [14/43] [S390] dasd: correct device table Greg KH
2011-05-06 0:25 ` [15/43] iwlagn: Support new 5000 microcode Greg KH
2011-05-06 0:25 ` [16/43] udp: Fix bogus UFO packet generation Greg KH
2011-05-06 0:25 ` [17/43] [PARISC] slub: fix panic with DISCONTIGMEM Greg KH
2011-05-06 0:25 ` [18/43] [PARISC] set memory ranges in N_NORMAL_MEMORY when onlined Greg KH
2011-05-06 0:25 ` [19/43] [media] FLEXCOP-PCI: fix __xlate_proc_name-warning for flexcop-pci Greg KH
2011-05-06 0:25 ` [20/43] m68k/mm: Set all online nodes in N_NORMAL_MEMORY Greg KH
2011-05-06 0:25 ` [21/43] nfs: dont lose MS_SYNCHRONOUS on remount of noac mount Greg KH
2011-05-06 0:25 ` [22/43] NFSv4.1: Ensure state manager thread dies on last umount Greg KH
2011-05-06 0:25 ` [23/43] agp: fix arbitrary kernel memory writes Greg KH
2011-05-06 0:25 ` [24/43] agp: fix OOM and buffer overflow Greg KH
2011-05-06 0:25 ` [25/43] Input: xen-kbdfront - fix mouse getting stuck after save/restore Greg KH
2011-05-06 0:25 ` [26/43] [SCSI] pmcraid: reject negative request size Greg KH
2011-05-06 0:25 ` [27/43] [SCSI] mpt2sas: prevent heap overflows and unchecked reads Greg KH
2011-05-06 0:25 ` [28/43] [SCSI] put stricter guards on queue dead checks Greg KH
2011-05-06 0:25 ` [29/43] mmc: sdhci-pci: Fix error case in sdhci_pci_probe_slot() Greg KH
2011-05-06 0:25 ` [30/43] mmc: sdhci: Check mrq->cmd in sdhci_tasklet_finish Greg KH
2011-05-06 0:25 ` [31/43] mmc: sdhci: Check mrq != NULL " Greg KH
2011-05-06 0:25 ` [32/43] USB: fix regression in usbip by setting has_tt flag Greg KH
2011-05-06 0:25 ` [33/43] x86, AMD: Fix APIC timer erratum 400 affecting K8 Rev.A-E processors Greg KH
2011-05-06 0:25 ` [34/43] af_unix: Only allow recv on connected seqpacket sockets Greg KH
2011-05-06 0:25 ` [35/43] ARM: 6891/1: prevent heap corruption in OABI semtimedop Greg KH
2011-05-06 0:25 ` [36/43] i8k: Tell gcc that *regs gets clobbered Greg KH
2011-05-06 0:25 ` [37/43] Fix gcc 4.5.1 miscompiling drivers/char/i8k.c (again) Greg KH
2011-05-06 0:25 ` [38/43] Open with O_CREAT flag set fails to open existing files on non writable directories Greg KH
2011-05-06 0:26 ` [39/43] can: Add missing socket check in can/bcm release Greg KH
2011-05-06 0:26 ` [40/43] fs/partitions/ldm.c: fix oops caused by corrupted partition table Greg KH
2011-05-06 0:26 ` [41/43] libata: set queue DMA alignment to sector size for ATAPI too Greg KH
2011-05-06 0:26 ` [42/43] usb: musb: core: set has_tt flag Greg KH
2011-05-06 0:26 ` [43/43] iwlwifi: fix skb usage after free Greg KH
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20110506002608.083192247@clark.kroah.org \
--to=gregkh@suse.de \
--cc=Trond.Myklebust@netapp.com \
--cc=akpm@linux-foundation.org \
--cc=alan@lxorguk.ukuu.org.uk \
--cc=linux-kernel@vger.kernel.org \
--cc=stable-review@kernel.org \
--cc=stable@kernel.org \
--cc=torvalds@linux-foundation.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®