Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1735645 > unrolled thread

[PATCH 02/10] cifs: honor AT_STATX_DONT_SYNC

Started byMiklos Szeredi <mszeredi@redhat.com>
First post2017-09-20 10:50 +0200
Last post2017-09-21 20:20 +0200
Articles 2 — 2 participants

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  [PATCH 02/10] cifs: honor AT_STATX_DONT_SYNC Miklos Szeredi <mszeredi@redhat.com> - 2017-09-20 10:50 +0200
    Re: [PATCH 02/10] cifs: honor AT_STATX_DONT_SYNC Steve French <smfrench@gmail.com> - 2017-09-21 20:20 +0200

#1735645 — [PATCH 02/10] cifs: honor AT_STATX_DONT_SYNC

FromMiklos Szeredi <mszeredi@redhat.com>
Date2017-09-20 10:50 +0200
Subject[PATCH 02/10] cifs: honor AT_STATX_DONT_SYNC
Message-ID<urIRI-Bk-23@gated-at.bofh.it>
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

[toc] | [next] | [standalone]


#1736990

FromSteve French <smfrench@gmail.com>
Date2017-09-21 20:20 +0200
Message-ID<useeR-4od-3@gated-at.bofh.it>
In reply to#1735645
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

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web