linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 00/10] honor AT_STATX_DONT_SYNC in netfs
@ 2017-09-20  8:39 Miklos Szeredi
  2017-09-20  8:39 ` [PATCH 01/10] ceph: honor AT_STATX_DONT_SYNC Miklos Szeredi
                   ` (9 more replies)
  0 siblings, 10 replies; 14+ messages in thread
From: Miklos Szeredi @ 2017-09-20  8:39 UTC (permalink / raw)
  To: linux-fsdevel; +Cc: linux-kernel, Al Viro, David Howells

This is pretty simple to do: all netfs getattr implementations consist of
two phases:

1) refresh attributes
2) fill in kstat

We just need to omit the first phase if this flag is given.
---
Miklos Szeredi (10):
  ceph: honor AT_STATX_DONT_SYNC
  cifs: honor AT_STATX_DONT_SYNC
  coda: honor AT_STATX_DONT_SYNC
  fuse: honor AT_STATX_DONT_SYNC
  gfs2: honor AT_STATX_DONT_SYNC
  lustre: honor AT_STATX_DONT_SYNC
  nfs: honor AT_STATX_DONT_SYNC
  ocfs2: honor AT_STATX_DONT_SYNC
  orangefs: honor AT_STATX_DONT_SYNC
  9p: honor AT_STATX_DONT_SYNC

 drivers/staging/lustre/lustre/llite/file.c | 12 +++++++-----
 fs/9p/vfs_inode.c                          |  4 +++-
 fs/9p/vfs_inode_dotl.c                     |  3 ++-
 fs/ceph/inode.c                            |  6 ++++--
 fs/cifs/inode.c                            | 30 ++++++++++++++++--------------
 fs/coda/inode.c                            |  5 ++++-
 fs/fuse/dir.c                              |  9 +++++----
 fs/gfs2/inode.c                            |  3 ++-
 fs/nfs/inode.c                             |  6 +++++-
 fs/ocfs2/file.c                            | 12 +++++++-----
 fs/orangefs/inode.c                        |  6 ++++--
 11 files changed, 59 insertions(+), 37 deletions(-)

-- 
2.5.5

^ permalink raw reply	[flat|nested] 14+ messages in thread

* [PATCH 01/10] ceph: honor AT_STATX_DONT_SYNC
  2017-09-20  8:39 [PATCH 00/10] honor AT_STATX_DONT_SYNC in netfs Miklos Szeredi
@ 2017-09-20  8:39 ` Miklos Szeredi
  2017-09-20  8:39 ` [PATCH 02/10] cifs: " Miklos Szeredi
                   ` (8 subsequent siblings)
  9 siblings, 0 replies; 14+ messages in thread
From: Miklos Szeredi @ 2017-09-20  8:39 UTC (permalink / raw)
  To: linux-fsdevel
  Cc: linux-kernel, Al Viro, David Howells, Ilya Dryomov, Yan, Zheng,
	Sage Weil

The description of this flag says "Don't sync attributes with the server".
In other words: always use the attributes cached in the kernel and don't
send network or local messages to refresh the attributes.

Signed-off-by: Miklos Szeredi <mszeredi@redhat.com>
Cc: Ilya Dryomov <idryomov@gmail.com>
Cc: "Yan, Zheng" <zyan@redhat.com>
Cc: Sage Weil <sage@redhat.com>
---
 fs/ceph/inode.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/fs/ceph/inode.c b/fs/ceph/inode.c
index 373dab5173ca..723002f6b060 100644
--- a/fs/ceph/inode.c
+++ b/fs/ceph/inode.c
@@ -2201,9 +2201,11 @@ int ceph_getattr(const struct path *path, struct kstat *stat,
 {
 	struct inode *inode = d_inode(path->dentry);
 	struct ceph_inode_info *ci = ceph_inode(inode);
-	int err;
+	int err = 0;
+
+	if (!(flags & AT_STATX_DONT_SYNC))
+		err = ceph_do_getattr(inode, CEPH_STAT_CAP_INODE_ALL, false);
 
-	err = ceph_do_getattr(inode, CEPH_STAT_CAP_INODE_ALL, false);
 	if (!err) {
 		generic_fillattr(inode, stat);
 		stat->ino = ceph_translate_ino(inode->i_sb, inode->i_ino);
-- 
2.5.5

^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [PATCH 02/10] cifs: honor AT_STATX_DONT_SYNC
  2017-09-20  8:39 [PATCH 00/10] honor AT_STATX_DONT_SYNC in netfs Miklos Szeredi
  2017-09-20  8:39 ` [PATCH 01/10] ceph: honor AT_STATX_DONT_SYNC Miklos Szeredi
@ 2017-09-20  8:39 ` Miklos Szeredi
  2017-09-21 18:14   ` Steve French
  2017-09-20  8:39 ` [PATCH 03/10] coda: " Miklos Szeredi
                   ` (7 subsequent siblings)
  9 siblings, 1 reply; 14+ messages in thread
From: Miklos Szeredi @ 2017-09-20  8:39 UTC (permalink / raw)
  To: linux-fsdevel; +Cc: linux-kernel, Al Viro, David Howells, Steve French

The description of this flag says "Don't sync attributes with the server".
In other words: always use the attributes cached in the kernel and don't
send network or local messages to refresh the attributes.

Signed-off-by: Miklos Szeredi <mszeredi@redhat.com>
Cc: Steve French <sfrench@samba.org>
---
 fs/cifs/inode.c | 30 ++++++++++++++++--------------
 1 file changed, 16 insertions(+), 14 deletions(-)

diff --git a/fs/cifs/inode.c b/fs/cifs/inode.c
index a8693632235f..982ba2e4f549 100644
--- a/fs/cifs/inode.c
+++ b/fs/cifs/inode.c
@@ -2003,22 +2003,24 @@ int cifs_getattr(const struct path *path, struct kstat *stat,
 	struct inode *inode = d_inode(dentry);
 	int rc;
 
-	/*
-	 * We need to be sure that all dirty pages are written and the server
-	 * has actual ctime, mtime and file length.
-	 */
-	if (!CIFS_CACHE_READ(CIFS_I(inode)) && inode->i_mapping &&
-	    inode->i_mapping->nrpages != 0) {
-		rc = filemap_fdatawait(inode->i_mapping);
-		if (rc) {
-			mapping_set_error(inode->i_mapping, rc);
-			return rc;
+	if (!(flags & AT_STATX_DONT_SYNC)) {
+		/*
+		 * We need to be sure that all dirty pages are written and the
+		 * server has actual ctime, mtime and file length.
+		 */
+		if (!CIFS_CACHE_READ(CIFS_I(inode)) && inode->i_mapping &&
+		    inode->i_mapping->nrpages != 0) {
+			rc = filemap_fdatawait(inode->i_mapping);
+			if (rc) {
+				mapping_set_error(inode->i_mapping, rc);
+				return rc;
+			}
 		}
-	}
 
-	rc = cifs_revalidate_dentry_attr(dentry);
-	if (rc)
-		return rc;
+		rc = cifs_revalidate_dentry_attr(dentry);
+		if (rc)
+			return rc;
+	}
 
 	generic_fillattr(inode, stat);
 	stat->blksize = CIFS_MAX_MSGSIZE;
-- 
2.5.5

^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [PATCH 03/10] coda: honor AT_STATX_DONT_SYNC
  2017-09-20  8:39 [PATCH 00/10] honor AT_STATX_DONT_SYNC in netfs Miklos Szeredi
  2017-09-20  8:39 ` [PATCH 01/10] ceph: honor AT_STATX_DONT_SYNC Miklos Szeredi
  2017-09-20  8:39 ` [PATCH 02/10] cifs: " Miklos Szeredi
@ 2017-09-20  8:39 ` Miklos Szeredi
  2017-09-20 20:04   ` Jan Harkes
  2017-09-20  8:39 ` [PATCH 04/10] fuse: " Miklos Szeredi
                   ` (6 subsequent siblings)
  9 siblings, 1 reply; 14+ messages in thread
From: Miklos Szeredi @ 2017-09-20  8:39 UTC (permalink / raw)
  To: linux-fsdevel; +Cc: linux-kernel, Al Viro, David Howells, Jan Harkes

The description of this flag says "Don't sync attributes with the server".
In other words: always use the attributes cached in the kernel and don't
send network or local messages to refresh the attributes.

Signed-off-by: Miklos Szeredi <mszeredi@redhat.com>
Cc: Jan Harkes <jaharkes@cs.cmu.edu>
---
 fs/coda/inode.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/fs/coda/inode.c b/fs/coda/inode.c
index 6058df380cc0..734672b2cbdc 100644
--- a/fs/coda/inode.c
+++ b/fs/coda/inode.c
@@ -255,7 +255,10 @@ static void coda_evict_inode(struct inode *inode)
 int coda_getattr(const struct path *path, struct kstat *stat,
 		 u32 request_mask, unsigned int flags)
 {
-	int err = coda_revalidate_inode(d_inode(path->dentry));
+	int err = 0;
+
+	if (!(flags & AT_STATX_DONT_SYNC))
+		err = coda_revalidate_inode(d_inode(path->dentry));
 	if (!err)
 		generic_fillattr(d_inode(path->dentry), stat);
 	return err;
-- 
2.5.5

^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [PATCH 04/10] fuse: honor AT_STATX_DONT_SYNC
  2017-09-20  8:39 [PATCH 00/10] honor AT_STATX_DONT_SYNC in netfs Miklos Szeredi
                   ` (2 preceding siblings ...)
  2017-09-20  8:39 ` [PATCH 03/10] coda: " Miklos Szeredi
@ 2017-09-20  8:39 ` Miklos Szeredi
  2017-09-20  8:40 ` [PATCH 05/10] gfs2: " Miklos Szeredi
                   ` (5 subsequent siblings)
  9 siblings, 0 replies; 14+ messages in thread
From: Miklos Szeredi @ 2017-09-20  8:39 UTC (permalink / raw)
  To: linux-fsdevel; +Cc: linux-kernel, Al Viro, David Howells

The description of this flag says "Don't sync attributes with the server".
In other words: always use the attributes cached in the kernel and don't
send network or local messages to refresh the attributes.

Signed-off-by: Miklos Szeredi <mszeredi@redhat.com>
---
 fs/fuse/dir.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/fs/fuse/dir.c b/fs/fuse/dir.c
index 622081b97426..d2d1dbe1ef75 100644
--- a/fs/fuse/dir.c
+++ b/fs/fuse/dir.c
@@ -924,12 +924,13 @@ static int fuse_do_getattr(struct inode *inode, struct kstat *stat,
 }
 
 static int fuse_update_get_attr(struct inode *inode, struct file *file,
-				struct kstat *stat)
+				struct kstat *stat, unsigned int flags)
 {
 	struct fuse_inode *fi = get_fuse_inode(inode);
 	int err = 0;
 
-	if (time_before64(fi->i_time, get_jiffies_64())) {
+	if (!(flags & AT_STATX_DONT_SYNC) &&
+	    time_before64(fi->i_time, get_jiffies_64())) {
 		forget_all_cached_acls(inode);
 		err = fuse_do_getattr(inode, stat, file);
 	} else if (stat) {
@@ -943,7 +944,7 @@ static int fuse_update_get_attr(struct inode *inode, struct file *file,
 
 int fuse_update_attributes(struct inode *inode, struct file *file)
 {
-	return fuse_update_get_attr(inode, file, NULL);
+	return fuse_update_get_attr(inode, file, NULL, 0);
 }
 
 int fuse_reverse_inval_entry(struct super_block *sb, u64 parent_nodeid,
@@ -1782,7 +1783,7 @@ static int fuse_getattr(const struct path *path, struct kstat *stat,
 	if (!fuse_allow_current_process(fc))
 		return -EACCES;
 
-	return fuse_update_get_attr(inode, NULL, stat);
+	return fuse_update_get_attr(inode, NULL, stat, flags);
 }
 
 static const struct inode_operations fuse_dir_inode_operations = {
-- 
2.5.5

^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [PATCH 05/10] gfs2: honor AT_STATX_DONT_SYNC
  2017-09-20  8:39 [PATCH 00/10] honor AT_STATX_DONT_SYNC in netfs Miklos Szeredi
                   ` (3 preceding siblings ...)
  2017-09-20  8:39 ` [PATCH 04/10] fuse: " Miklos Szeredi
@ 2017-09-20  8:40 ` Miklos Szeredi
  2017-09-20  8:40 ` [PATCH 06/10] lustre: " Miklos Szeredi
                   ` (4 subsequent siblings)
  9 siblings, 0 replies; 14+ messages in thread
From: Miklos Szeredi @ 2017-09-20  8:40 UTC (permalink / raw)
  To: linux-fsdevel
  Cc: linux-kernel, Al Viro, David Howells, Bob Peterson,
	Steven Whitehouse

The description of this flag says "Don't sync attributes with the server".
In other words: always use the attributes cached in the kernel and don't
send network or local messages to refresh the attributes.

Signed-off-by: Miklos Szeredi <mszeredi@redhat.com>
Cc: Bob Peterson <rpeterso@redhat.com>
Cc: Steven Whitehouse <swhiteho@redhat.com>
---
 fs/gfs2/inode.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/fs/gfs2/inode.c b/fs/gfs2/inode.c
index 863749e29bf9..c59d36a3b724 100644
--- a/fs/gfs2/inode.c
+++ b/fs/gfs2/inode.c
@@ -1989,7 +1989,8 @@ static int gfs2_getattr(const struct path *path, struct kstat *stat,
 	int error;
 
 	gfs2_holder_mark_uninitialized(&gh);
-	if (gfs2_glock_is_locked_by_me(ip->i_gl) == NULL) {
+	if (!(flags & AT_STATX_DONT_SYNC) &&
+	    gfs2_glock_is_locked_by_me(ip->i_gl) == NULL) {
 		error = gfs2_glock_nq_init(ip->i_gl, LM_ST_SHARED, LM_FLAG_ANY, &gh);
 		if (error)
 			return error;
-- 
2.5.5

^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [PATCH 06/10] lustre: honor AT_STATX_DONT_SYNC
  2017-09-20  8:39 [PATCH 00/10] honor AT_STATX_DONT_SYNC in netfs Miklos Szeredi
                   ` (4 preceding siblings ...)
  2017-09-20  8:40 ` [PATCH 05/10] gfs2: " Miklos Szeredi
@ 2017-09-20  8:40 ` Miklos Szeredi
  2017-09-20  8:40 ` [PATCH 07/10] nfs: " Miklos Szeredi
                   ` (3 subsequent siblings)
  9 siblings, 0 replies; 14+ messages in thread
From: Miklos Szeredi @ 2017-09-20  8:40 UTC (permalink / raw)
  To: linux-fsdevel
  Cc: linux-kernel, Al Viro, David Howells, Oleg Drokin, Andreas Dilger,
	James Simmons

The description of this flag says "Don't sync attributes with the server".
In other words: always use the attributes cached in the kernel and don't
send network or local messages to refresh the attributes.

Signed-off-by: Miklos Szeredi <mszeredi@redhat.com>
Cc: Oleg Drokin <oleg.drokin@intel.com>
Cc: Andreas Dilger <andreas.dilger@intel.com>
Cc: James Simmons <jsimmons@infradead.org>
---
 drivers/staging/lustre/lustre/llite/file.c | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)

diff --git a/drivers/staging/lustre/lustre/llite/file.c b/drivers/staging/lustre/lustre/llite/file.c
index be665454f407..decbe5eb0c9d 100644
--- a/drivers/staging/lustre/lustre/llite/file.c
+++ b/drivers/staging/lustre/lustre/llite/file.c
@@ -2955,14 +2955,16 @@ int ll_getattr(const struct path *path, struct kstat *stat,
 	struct ll_inode_info *lli = ll_i2info(inode);
 	int res;
 
-	res = ll_inode_revalidate(path->dentry,
+	if (!(flags & AT_STATX_DONT_SYNC)) {
+		res = ll_inode_revalidate(path->dentry,
 				  MDS_INODELOCK_UPDATE | MDS_INODELOCK_LOOKUP);
-	ll_stats_ops_tally(sbi, LPROC_LL_GETATTR, 1);
+		ll_stats_ops_tally(sbi, LPROC_LL_GETATTR, 1);
 
-	if (res)
-		return res;
+		if (res)
+			return res;
 
-	OBD_FAIL_TIMEOUT(OBD_FAIL_GETATTR_DELAY, 30);
+		OBD_FAIL_TIMEOUT(OBD_FAIL_GETATTR_DELAY, 30);
+	}
 
 	stat->dev = inode->i_sb->s_dev;
 	if (ll_need_32bit_api(sbi))
-- 
2.5.5

^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [PATCH 07/10] nfs: honor AT_STATX_DONT_SYNC
  2017-09-20  8:39 [PATCH 00/10] honor AT_STATX_DONT_SYNC in netfs Miklos Szeredi
                   ` (5 preceding siblings ...)
  2017-09-20  8:40 ` [PATCH 06/10] lustre: " Miklos Szeredi
@ 2017-09-20  8:40 ` Miklos Szeredi
  2017-09-20  8:40 ` [PATCH 08/10] ocfs2: " Miklos Szeredi
                   ` (2 subsequent siblings)
  9 siblings, 0 replies; 14+ messages in thread
From: Miklos Szeredi @ 2017-09-20  8:40 UTC (permalink / raw)
  To: linux-fsdevel
  Cc: linux-kernel, Al Viro, David Howells, Trond Myklebust,
	Anna Schumaker

The description of this flag says "Don't sync attributes with the server".
In other words: always use the attributes cached in the kernel and don't
send network or local messages to refresh the attributes.

Signed-off-by: Miklos Szeredi <mszeredi@redhat.com>
Cc: Trond Myklebust <trond.myklebust@primarydata.com>
Cc: Anna Schumaker <anna.schumaker@netapp.com>
---
 fs/nfs/inode.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/fs/nfs/inode.c b/fs/nfs/inode.c
index 134d9f560240..487e99ba7d33 100644
--- a/fs/nfs/inode.c
+++ b/fs/nfs/inode.c
@@ -739,6 +739,10 @@ int nfs_getattr(const struct path *path, struct kstat *stat,
 	int err = 0;
 
 	trace_nfs_getattr_enter(inode);
+
+	if (query_flags & AT_STATX_DONT_SYNC)
+		goto out;
+
 	/* Flush out writes to the server in order to update c/mtime.  */
 	if (S_ISREG(inode->i_mode)) {
 		err = filemap_write_and_wait(inode->i_mapping);
@@ -769,13 +773,13 @@ int nfs_getattr(const struct path *path, struct kstat *stat,
 		err = __nfs_revalidate_inode(server, inode);
 	} else
 		nfs_readdirplus_parent_cache_hit(path->dentry);
+out:
 	if (!err) {
 		generic_fillattr(inode, stat);
 		stat->ino = nfs_compat_user_ino64(NFS_FILEID(inode));
 		if (S_ISDIR(inode->i_mode))
 			stat->blksize = NFS_SERVER(inode)->dtsize;
 	}
-out:
 	trace_nfs_getattr_exit(inode, err);
 	return err;
 }
-- 
2.5.5

^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [PATCH 08/10] ocfs2: honor AT_STATX_DONT_SYNC
  2017-09-20  8:39 [PATCH 00/10] honor AT_STATX_DONT_SYNC in netfs Miklos Szeredi
                   ` (6 preceding siblings ...)
  2017-09-20  8:40 ` [PATCH 07/10] nfs: " Miklos Szeredi
@ 2017-09-20  8:40 ` Miklos Szeredi
  2017-09-20  8:40 ` [PATCH 09/10] orangefs: " Miklos Szeredi
  2017-09-20  8:40 ` [PATCH 10/10] 9p: " Miklos Szeredi
  9 siblings, 0 replies; 14+ messages in thread
From: Miklos Szeredi @ 2017-09-20  8:40 UTC (permalink / raw)
  To: linux-fsdevel
  Cc: linux-kernel, Al Viro, David Howells, Mark Fasheh, Joel Becker

The description of this flag says "Don't sync attributes with the server".
In other words: always use the attributes cached in the kernel and don't
send network or local messages to refresh the attributes.

Signed-off-by: Miklos Szeredi <mszeredi@redhat.com>
Cc: Mark Fasheh <mfasheh@versity.com>
Cc: Joel Becker <jlbec@evilplan.org>
---
 fs/ocfs2/file.c | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)

diff --git a/fs/ocfs2/file.c b/fs/ocfs2/file.c
index 6e41fc8fabbe..2d248d71c275 100644
--- a/fs/ocfs2/file.c
+++ b/fs/ocfs2/file.c
@@ -1307,11 +1307,13 @@ int ocfs2_getattr(const struct path *path, struct kstat *stat,
 	struct ocfs2_super *osb = sb->s_fs_info;
 	int err;
 
-	err = ocfs2_inode_revalidate(path->dentry);
-	if (err) {
-		if (err != -ENOENT)
-			mlog_errno(err);
-		goto bail;
+	if (!(flags & AT_STATX_DONT_SYNC)) {
+		err = ocfs2_inode_revalidate(path->dentry);
+		if (err) {
+			if (err != -ENOENT)
+				mlog_errno(err);
+			goto bail;
+		}
 	}
 
 	generic_fillattr(inode, stat);
-- 
2.5.5

^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [PATCH 09/10] orangefs: honor AT_STATX_DONT_SYNC
  2017-09-20  8:39 [PATCH 00/10] honor AT_STATX_DONT_SYNC in netfs Miklos Szeredi
                   ` (7 preceding siblings ...)
  2017-09-20  8:40 ` [PATCH 08/10] ocfs2: " Miklos Szeredi
@ 2017-09-20  8:40 ` Miklos Szeredi
  2017-09-20  8:40 ` [PATCH 10/10] 9p: " Miklos Szeredi
  9 siblings, 0 replies; 14+ messages in thread
From: Miklos Szeredi @ 2017-09-20  8:40 UTC (permalink / raw)
  To: linux-fsdevel; +Cc: linux-kernel, Al Viro, David Howells, Mike Marshall

The description of this flag says "Don't sync attributes with the server".
In other words: always use the attributes cached in the kernel and don't
send network or local messages to refresh the attributes.

Signed-off-by: Miklos Szeredi <mszeredi@redhat.com>
Cc: Mike Marshall <hubcap@omnibond.com>
---
 fs/orangefs/inode.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/fs/orangefs/inode.c b/fs/orangefs/inode.c
index 9428ea0aac16..1b3c4c4dd3d4 100644
--- a/fs/orangefs/inode.c
+++ b/fs/orangefs/inode.c
@@ -247,7 +247,7 @@ int orangefs_setattr(struct dentry *dentry, struct iattr *iattr)
 int orangefs_getattr(const struct path *path, struct kstat *stat,
 		     u32 request_mask, unsigned int flags)
 {
-	int ret = -ENOENT;
+	int ret = 0;
 	struct inode *inode = path->dentry->d_inode;
 	struct orangefs_inode_s *orangefs_inode = NULL;
 
@@ -255,7 +255,9 @@ int orangefs_getattr(const struct path *path, struct kstat *stat,
 		     "orangefs_getattr: called on %pd\n",
 		     path->dentry);
 
-	ret = orangefs_inode_getattr(inode, 0, 0, request_mask);
+	if (!(flags & AT_STATX_DONT_SYNC))
+		ret = orangefs_inode_getattr(inode, 0, 0, request_mask);
+
 	if (ret == 0) {
 		generic_fillattr(inode, stat);
 
-- 
2.5.5

^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [PATCH 10/10] 9p: honor AT_STATX_DONT_SYNC
  2017-09-20  8:39 [PATCH 00/10] honor AT_STATX_DONT_SYNC in netfs Miklos Szeredi
                   ` (8 preceding siblings ...)
  2017-09-20  8:40 ` [PATCH 09/10] orangefs: " Miklos Szeredi
@ 2017-09-20  8:40 ` Miklos Szeredi
  9 siblings, 0 replies; 14+ messages in thread
From: Miklos Szeredi @ 2017-09-20  8:40 UTC (permalink / raw)
  To: linux-fsdevel
  Cc: linux-kernel, Al Viro, David Howells, Eric Van Hensbergen,
	Ron Minnich, Latchesar Ionkov

The description of this flag says "Don't sync attributes with the server".
In other words: always use the attributes cached in the kernel and don't
send network or local messages to refresh the attributes.

Signed-off-by: Miklos Szeredi <mszeredi@redhat.com>
Cc: Eric Van Hensbergen <ericvh@gmail.com>
Cc: Ron Minnich <rminnich@sandia.gov>
Cc: Latchesar Ionkov <lucho@ionkov.net>
---
 fs/9p/vfs_inode.c      | 4 +++-
 fs/9p/vfs_inode_dotl.c | 3 ++-
 2 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/fs/9p/vfs_inode.c b/fs/9p/vfs_inode.c
index 2a5de610dd8f..0a7063f12c0b 100644
--- a/fs/9p/vfs_inode.c
+++ b/fs/9p/vfs_inode.c
@@ -1065,7 +1065,9 @@ v9fs_vfs_getattr(const struct path *path, struct kstat *stat,
 
 	p9_debug(P9_DEBUG_VFS, "dentry: %p\n", dentry);
 	v9ses = v9fs_dentry2v9ses(dentry);
-	if (v9ses->cache == CACHE_LOOSE || v9ses->cache == CACHE_FSCACHE) {
+
+	if (v9ses->cache == CACHE_LOOSE || v9ses->cache == CACHE_FSCACHE ||
+	    (flags & AT_STATX_DONT_SYNC)) {
 		generic_fillattr(d_inode(dentry), stat);
 		return 0;
 	}
diff --git a/fs/9p/vfs_inode_dotl.c b/fs/9p/vfs_inode_dotl.c
index 70f9887c59a9..92bf43981a0d 100644
--- a/fs/9p/vfs_inode_dotl.c
+++ b/fs/9p/vfs_inode_dotl.c
@@ -478,7 +478,8 @@ v9fs_vfs_getattr_dotl(const struct path *path, struct kstat *stat,
 
 	p9_debug(P9_DEBUG_VFS, "dentry: %p\n", dentry);
 	v9ses = v9fs_dentry2v9ses(dentry);
-	if (v9ses->cache == CACHE_LOOSE || v9ses->cache == CACHE_FSCACHE) {
+	if (v9ses->cache == CACHE_LOOSE || v9ses->cache == CACHE_FSCACHE ||
+	    (flags & AT_STATX_DONT_SYNC)) {
 		generic_fillattr(d_inode(dentry), stat);
 		return 0;
 	}
-- 
2.5.5

^ permalink raw reply related	[flat|nested] 14+ messages in thread

* Re: [PATCH 03/10] coda: honor AT_STATX_DONT_SYNC
  2017-09-20  8:39 ` [PATCH 03/10] coda: " Miklos Szeredi
@ 2017-09-20 20:04   ` Jan Harkes
  2017-09-21 12:45     ` Miklos Szeredi
  0 siblings, 1 reply; 14+ messages in thread
From: Jan Harkes @ 2017-09-20 20:04 UTC (permalink / raw)
  To: Miklos Szeredi; +Cc: linux-fsdevel, linux-kernel, Al Viro, David Howells

On Wed, Sep 20, 2017 at 10:39:58AM +0200, Miklos Szeredi wrote:
> The description of this flag says "Don't sync attributes with the server".
> In other words: always use the attributes cached in the kernel and don't
> send network or local messages to refresh the attributes.

What is the use case for this AT_STATX_DONT_SYNC flag?

I'm asking because the Coda userspace client potentially has attributes
that are not cached in the kernel but can be (re-)validated without
network communication. So if we just care about avoiding network
traffic we could propagate the flag up to userspace. If we want to avoid
context switches, disk I/O and only check on what happens to be cached
in the kernel the current approach works fine.

Jan

> Signed-off-by: Miklos Szeredi <mszeredi@redhat.com>
> Cc: Jan Harkes <jaharkes@cs.cmu.edu>
> ---
>  fs/coda/inode.c | 5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)
> 
> diff --git a/fs/coda/inode.c b/fs/coda/inode.c
> index 6058df380cc0..734672b2cbdc 100644
> --- a/fs/coda/inode.c
> +++ b/fs/coda/inode.c
> @@ -255,7 +255,10 @@ static void coda_evict_inode(struct inode *inode)
>  int coda_getattr(const struct path *path, struct kstat *stat,
>  		 u32 request_mask, unsigned int flags)
>  {
> -	int err = coda_revalidate_inode(d_inode(path->dentry));
> +	int err = 0;
> +
> +	if (!(flags & AT_STATX_DONT_SYNC))
> +		err = coda_revalidate_inode(d_inode(path->dentry));
>  	if (!err)
>  		generic_fillattr(d_inode(path->dentry), stat);
>  	return err;
> -- 
> 2.5.5
> 
> 

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH 03/10] coda: honor AT_STATX_DONT_SYNC
  2017-09-20 20:04   ` Jan Harkes
@ 2017-09-21 12:45     ` Miklos Szeredi
  0 siblings, 0 replies; 14+ messages in thread
From: Miklos Szeredi @ 2017-09-21 12:45 UTC (permalink / raw)
  To: Jan Harkes; +Cc: linux-fsdevel, lkml, Al Viro, David Howells

On Wed, Sep 20, 2017 at 10:04 PM, Jan Harkes <jaharkes@cs.cmu.edu> wrote:
> On Wed, Sep 20, 2017 at 10:39:58AM +0200, Miklos Szeredi wrote:
>> The description of this flag says "Don't sync attributes with the server".
>> In other words: always use the attributes cached in the kernel and don't
>> send network or local messages to refresh the attributes.
>
> What is the use case for this AT_STATX_DONT_SYNC flag?
>
> I'm asking because the Coda userspace client potentially has attributes
> that are not cached in the kernel but can be (re-)validated without
> network communication. So if we just care about avoiding network
> traffic we could propagate the flag up to userspace. If we want to avoid
> context switches, disk I/O and only check on what happens to be cached
> in the kernel the current approach works fine.

It's an interesting question, "server" could mean several different
things depending on the context.  I interpreted it as "any entity
outside the kernel the filesystem resides in", mainly because it's the
simplest interpretation.

Thanks,
Miklos


>> Signed-off-by: Miklos Szeredi <mszeredi@redhat.com>
>> Cc: Jan Harkes <jaharkes@cs.cmu.edu>
>> ---
>>  fs/coda/inode.c | 5 ++++-
>>  1 file changed, 4 insertions(+), 1 deletion(-)
>>
>> diff --git a/fs/coda/inode.c b/fs/coda/inode.c
>> index 6058df380cc0..734672b2cbdc 100644
>> --- a/fs/coda/inode.c
>> +++ b/fs/coda/inode.c
>> @@ -255,7 +255,10 @@ static void coda_evict_inode(struct inode *inode)
>>  int coda_getattr(const struct path *path, struct kstat *stat,
>>                u32 request_mask, unsigned int flags)
>>  {
>> -     int err = coda_revalidate_inode(d_inode(path->dentry));
>> +     int err = 0;
>> +
>> +     if (!(flags & AT_STATX_DONT_SYNC))
>> +             err = coda_revalidate_inode(d_inode(path->dentry));
>>       if (!err)
>>               generic_fillattr(d_inode(path->dentry), stat);
>>       return err;
>> --
>> 2.5.5
>>
>>

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH 02/10] cifs: honor AT_STATX_DONT_SYNC
  2017-09-20  8:39 ` [PATCH 02/10] cifs: " Miklos Szeredi
@ 2017-09-21 18:14   ` Steve French
  0 siblings, 0 replies; 14+ messages in thread
From: Steve French @ 2017-09-21 18:14 UTC (permalink / raw)
  To: Miklos Szeredi; +Cc: linux-fsdevel, LKML, Al Viro, David Howells, Steve French

Do you have any sample program/code to query with this flag?

On Wed, Sep 20, 2017 at 3:39 AM, Miklos Szeredi <mszeredi@redhat.com> wrote:
> The description of this flag says "Don't sync attributes with the server".
> In other words: always use the attributes cached in the kernel and don't
> send network or local messages to refresh the attributes.
>
> Signed-off-by: Miklos Szeredi <mszeredi@redhat.com>
> Cc: Steve French <sfrench@samba.org>
> ---
>  fs/cifs/inode.c | 30 ++++++++++++++++--------------
>  1 file changed, 16 insertions(+), 14 deletions(-)
>
> diff --git a/fs/cifs/inode.c b/fs/cifs/inode.c
> index a8693632235f..982ba2e4f549 100644
> --- a/fs/cifs/inode.c
> +++ b/fs/cifs/inode.c
> @@ -2003,22 +2003,24 @@ int cifs_getattr(const struct path *path, struct kstat *stat,
>         struct inode *inode = d_inode(dentry);
>         int rc;
>
> -       /*
> -        * We need to be sure that all dirty pages are written and the server
> -        * has actual ctime, mtime and file length.
> -        */
> -       if (!CIFS_CACHE_READ(CIFS_I(inode)) && inode->i_mapping &&
> -           inode->i_mapping->nrpages != 0) {
> -               rc = filemap_fdatawait(inode->i_mapping);
> -               if (rc) {
> -                       mapping_set_error(inode->i_mapping, rc);
> -                       return rc;
> +       if (!(flags & AT_STATX_DONT_SYNC)) {
> +               /*
> +                * We need to be sure that all dirty pages are written and the
> +                * server has actual ctime, mtime and file length.
> +                */
> +               if (!CIFS_CACHE_READ(CIFS_I(inode)) && inode->i_mapping &&
> +                   inode->i_mapping->nrpages != 0) {
> +                       rc = filemap_fdatawait(inode->i_mapping);
> +                       if (rc) {
> +                               mapping_set_error(inode->i_mapping, rc);
> +                               return rc;
> +                       }
>                 }
> -       }
>
> -       rc = cifs_revalidate_dentry_attr(dentry);
> -       if (rc)
> -               return rc;
> +               rc = cifs_revalidate_dentry_attr(dentry);
> +               if (rc)
> +                       return rc;
> +       }
>
>         generic_fillattr(inode, stat);
>         stat->blksize = CIFS_MAX_MSGSIZE;
> --
> 2.5.5
>



-- 
Thanks,

Steve

^ permalink raw reply	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2017-09-21 18:14 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-09-20  8:39 [PATCH 00/10] honor AT_STATX_DONT_SYNC in netfs Miklos Szeredi
2017-09-20  8:39 ` [PATCH 01/10] ceph: honor AT_STATX_DONT_SYNC Miklos Szeredi
2017-09-20  8:39 ` [PATCH 02/10] cifs: " Miklos Szeredi
2017-09-21 18:14   ` Steve French
2017-09-20  8:39 ` [PATCH 03/10] coda: " Miklos Szeredi
2017-09-20 20:04   ` Jan Harkes
2017-09-21 12:45     ` Miklos Szeredi
2017-09-20  8:39 ` [PATCH 04/10] fuse: " Miklos Szeredi
2017-09-20  8:40 ` [PATCH 05/10] gfs2: " Miklos Szeredi
2017-09-20  8:40 ` [PATCH 06/10] lustre: " Miklos Szeredi
2017-09-20  8:40 ` [PATCH 07/10] nfs: " Miklos Szeredi
2017-09-20  8:40 ` [PATCH 08/10] ocfs2: " Miklos Szeredi
2017-09-20  8:40 ` [PATCH 09/10] orangefs: " Miklos Szeredi
2017-09-20  8:40 ` [PATCH 10/10] 9p: " Miklos Szeredi

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).