Skip to contentSkip to conversation

NFS: Add a helper to set attribute barriers

PATCH Chuck Lever 2 participants 2 messages Mar 2, 2015 1 message not in the archive

Subsystems (2)
lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

Chuck Lever

author Tested-by
#1 lore raw
Quoted 1 line · Trond Myklebust

I applied this series and the patch that addresses the generic/133 O_DIRECT regression to stock 3.19.0.

I tested using xfstests with NFSv3 and NFSv4.0, Solaris 11 update 2 and Linux 3.19 servers. No new test failures (between 2 and 4 failures out of 55 tests run, which is typical).

I also used dbench and fio to look for performance regressions. No regression found so far.

Quoted 47 lines

---
fs/nfs/inode.c | 16 ++++++++++++++++
include/linux/nfs_fs.h | 1 +

2 files changed, 17 insertions(+)
fs/nfs/inode.c +16 -0
index 83107be3dd01..b0cbc1ba82da 100644
@@ -1260,6 +1260,22 @@ void nfs_fattr_init(struct nfs_fattr *fattr)
 }
 EXPORT_SYMBOL_GPL(nfs_fattr_init);
 
+/**
+ * nfs_fattr_set_barrier
+ * @fattr: attributes
+ *
+ * Used to set a barrier after an attribute was updated. This
+ * barrier ensures that older attributes from RPC calls that may
+ * have raced with our update cannot clobber these new values.
+ * Note that you are still responsible for ensuring that other
+ * operations which change the attribute on the server do not
+ * collide.
+ */
+void nfs_fattr_set_barrier(struct nfs_fattr *fattr)
+{
+	fattr->gencount = nfs_inc_attr_generation_counter();
+}
+
 struct nfs_fattr *nfs_alloc_fattr(void)
 {
 	struct nfs_fattr *fattr;
include/linux/nfs_fs.h +1 -0
index 2f77e0c651c8..3a4ffb5856cd 100644
@@ -369,6 +369,7 @@ extern struct nfs_lock_context *nfs_get_lock_context(struct nfs_open_context *ct
 extern void nfs_put_lock_context(struct nfs_lock_context *l_ctx);
 extern u64 nfs_compat_user_ino64(u64 fileid);
 extern void nfs_fattr_init(struct nfs_fattr *fattr);
+extern void nfs_fattr_set_barrier(struct nfs_fattr *fattr);
 extern unsigned long nfs_inc_attr_generation_counter(void);
 
 extern struct nfs_fattr *nfs_alloc_fattr(void);
Signature · 1 line
2.1.0

--
Chuck Lever
chuck[dot]lever[at]oracle[dot]com

#2 lore raw
Quoted 10 lines · Chuck Lever
Quoted 1 line · Trond Myklebust

I applied this series and the patch that addresses the generic/133 O_DIRECT regression to stock 3.19.0.

Quoted 7 lines

I tested using xfstests with NFSv3 and NFSv4.0, Solaris 11 update 2 and Linux 3.19 servers. No new test failures (between 2 and 4 failures out of 55 tests run, which is typical).

I also used dbench and fio to look for performance regressions. No regression found so far.

Thanks!

Signature · 3 lines
Trond Myklebust
Linux NFS client maintainer, PrimaryData
[email protected]