handle fs types with coarser granularity
diff mbox

Message ID 4a4634331001131318w37748abbx47291060d09e2709@mail.gmail.com
State New
Headers show

Commit Message

Shirish Pargaonkar Jan. 13, 2010, 9:18 p.m. UTC
force revalidate of the file when any of the timestamps are set for
filesytem type does not have finer granularity timestamps.
samba bugzilla 3775


From 77d285ad59ebf163c2c3be2d0b4f6df1e4d19917 Mon Sep 17 00:00:00 2001
From: Shirish Pargaonkar <shirishpargaonkar@gmail.com>
Date: Wed, 13 Jan 2010 15:06:34 -0600
Subject: [PATCH] force revalidate to accomodate coarser granularity timestamps

Signed-off-by: Shirish Pargaonkar <shirishpargaonkar@gmail.com>
---
 fs/cifs/inode.c |   14 ++++++++++++--
 1 files changed, 12 insertions(+), 2 deletions(-)

 	kfree(full_path);

Comments

Jeff Layton Jan. 13, 2010, 11:18 p.m. UTC | #1
On Wed, 13 Jan 2010 15:18:45 -0600
Shirish Pargaonkar <shirishpargaonkar@gmail.com> wrote:

> force revalidate of the file when any of the timestamps are set for
> filesytem type does not have finer granularity timestamps.
> samba bugzilla 3775
> 
> 
> From 77d285ad59ebf163c2c3be2d0b4f6df1e4d19917 Mon Sep 17 00:00:00 2001
> From: Shirish Pargaonkar <shirishpargaonkar@gmail.com>
> Date: Wed, 13 Jan 2010 15:06:34 -0600
> Subject: [PATCH] force revalidate to accomodate coarser granularity timestamps
> 
> Signed-off-by: Shirish Pargaonkar <shirishpargaonkar@gmail.com>
> ---
>  fs/cifs/inode.c |   14 ++++++++++++--
>  1 files changed, 12 insertions(+), 2 deletions(-)
> 
> diff --git a/fs/cifs/inode.c b/fs/cifs/inode.c
> index cf18ee7..7db26a5 100644
> --- a/fs/cifs/inode.c
> +++ b/fs/cifs/inode.c
> @@ -1762,8 +1762,18 @@ cifs_setattr_unix(struct dentry *direntry,
> struct iattr *attrs)
>  					CIFS_MOUNT_MAP_SPECIAL_CHR);
>  	}
> 
> -	if (!rc)
> -		rc = inode_setattr(inode, attrs);
> +	if (rc)
> +		goto out;
> +
> +	rc = inode_setattr(inode, attrs);
> +
> +	/*
> +	 * force revalidate when any of the times are set since some
> +	 * of the fs types do not have finer granularity timestamps
> +	 */
> +	if ((!rc) && (attrs->ia_valid & (ATTR_ATIME | ATTR_MTIME | ATTR_CTIME)))
	    ^^^^^
	The extra parens around !rc aren't needed here. It'll be more readable without them.

> +		cifsInode->time = 0;
> +
>  out:
>  	kfree(args);
>  	kfree(full_path);

Other than the minor nit above...

Acked-by: Jeff Layton <jlayton@redhat.com>

Patch
diff mbox

diff --git a/fs/cifs/inode.c b/fs/cifs/inode.c
index cf18ee7..7db26a5 100644
--- a/fs/cifs/inode.c
+++ b/fs/cifs/inode.c
@@ -1762,8 +1762,18 @@  cifs_setattr_unix(struct dentry *direntry,
struct iattr *attrs)
 					CIFS_MOUNT_MAP_SPECIAL_CHR);
 	}

-	if (!rc)
-		rc = inode_setattr(inode, attrs);
+	if (rc)
+		goto out;
+
+	rc = inode_setattr(inode, attrs);
+
+	/*
+	 * force revalidate when any of the times are set since some
+	 * of the fs types do not have finer granularity timestamps
+	 */
+	if ((!rc) && (attrs->ia_valid & (ATTR_ATIME | ATTR_MTIME | ATTR_CTIME)))
+		cifsInode->time = 0;
+
 out:
 	kfree(args);