diff mbox series

[3/3] CIFS: Force reval dentry if LOOKUP_REVAL flag is set

Message ID 20190930170620.29979-3-pshilov@microsoft.com
State New
Headers show
Series [1/3] CIFS: Gracefully handle QueryInfo errors during open | expand

Commit Message

Pavel Shilovsky Sept. 30, 2019, 5:06 p.m. UTC
Mark inode for force revalidation if LOOKUP_REVAL flag is set.
This tells the client to actually send a QueryInfo request to
the server to obtain the latest metadata in case a directory
or a file were changed remotely.

Cc: <stable@vger.kernel.org>
Signed-off-by: Pavel Shilovsky <pshilov@microsoft.com>
---
 fs/cifs/dir.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

Comments

Pavel Shilovsky Oct. 10, 2019, 6:06 p.m. UTC | #1
The updated version of this has been merged into for-next:

https://git.samba.org/?p=sfrench/cifs-2.6.git;a=commitdiff;h=0b3d0ef9840f7be202393ca9116b857f6f793715

--
Best regards,
Pavel Shilovsky

пн, 30 сент. 2019 г. в 10:06, Pavel Shilovsky <piastryyy@gmail.com>:
>
> Mark inode for force revalidation if LOOKUP_REVAL flag is set.
> This tells the client to actually send a QueryInfo request to
> the server to obtain the latest metadata in case a directory
> or a file were changed remotely.
>
> Cc: <stable@vger.kernel.org>
> Signed-off-by: Pavel Shilovsky <pshilov@microsoft.com>
> ---
>  fs/cifs/dir.c | 8 +++++++-
>  1 file changed, 7 insertions(+), 1 deletion(-)
>
> diff --git a/fs/cifs/dir.c b/fs/cifs/dir.c
> index be424e81e3ad..91a46b01d748 100644
> --- a/fs/cifs/dir.c
> +++ b/fs/cifs/dir.c
> @@ -738,10 +738,16 @@ cifs_lookup(struct inode *parent_dir_inode, struct dentry *direntry,
>  static int
>  cifs_d_revalidate(struct dentry *direntry, unsigned int flags)
>  {
> +       struct inode *inode;
> +
>         if (flags & LOOKUP_RCU)
>                 return -ECHILD;
>
>         if (d_really_is_positive(direntry)) {
> +               inode = d_inode(direntry);
> +               if (flags & LOOKUP_REVAL)
> +                       CIFS_I(inode)->time = 0; /* force reval */
> +
>                 if (cifs_revalidate_dentry(direntry))
>                         return 0;
>                 else {
> @@ -752,7 +758,7 @@ cifs_d_revalidate(struct dentry *direntry, unsigned int flags)
>                          * attributes will have been updated by
>                          * cifs_revalidate_dentry().
>                          */
> -                       if (IS_AUTOMOUNT(d_inode(direntry)) &&
> +                       if (IS_AUTOMOUNT(inode) &&
>                            !(direntry->d_flags & DCACHE_NEED_AUTOMOUNT)) {
>                                 spin_lock(&direntry->d_lock);
>                                 direntry->d_flags |= DCACHE_NEED_AUTOMOUNT;
> --
> 2.17.1
>
diff mbox series

Patch

diff --git a/fs/cifs/dir.c b/fs/cifs/dir.c
index be424e81e3ad..91a46b01d748 100644
--- a/fs/cifs/dir.c
+++ b/fs/cifs/dir.c
@@ -738,10 +738,16 @@  cifs_lookup(struct inode *parent_dir_inode, struct dentry *direntry,
 static int
 cifs_d_revalidate(struct dentry *direntry, unsigned int flags)
 {
+	struct inode *inode;
+
 	if (flags & LOOKUP_RCU)
 		return -ECHILD;
 
 	if (d_really_is_positive(direntry)) {
+		inode = d_inode(direntry);
+		if (flags & LOOKUP_REVAL)
+			CIFS_I(inode)->time = 0; /* force reval */
+
 		if (cifs_revalidate_dentry(direntry))
 			return 0;
 		else {
@@ -752,7 +758,7 @@  cifs_d_revalidate(struct dentry *direntry, unsigned int flags)
 			 * attributes will have been updated by
 			 * cifs_revalidate_dentry().
 			 */
-			if (IS_AUTOMOUNT(d_inode(direntry)) &&
+			if (IS_AUTOMOUNT(inode) &&
 			   !(direntry->d_flags & DCACHE_NEED_AUTOMOUNT)) {
 				spin_lock(&direntry->d_lock);
 				direntry->d_flags |= DCACHE_NEED_AUTOMOUNT;