[linux-cifs] Re: [PATCH] cifs: When "refer file directly", make new inode cache if "uniqueid is different"


Looks correct.

Reviewed-by: Shirish Pargaonkar 


On Tue, Dec 23, 2014 at 8:27 PM, Nakajima Akira
 wrote:
> When refer file "directly" (e.g. ls -li ),
>  if file is same name, old inode cache is used.
> This causes that client shows wrong(old) inode number.
> So this patch is that if uniqueid is different, return error.
>
> ## But this patch is applicable to when Server is UNIX.
> ## When Server is Windows, we need another new patch.
>
>
> Reproducible sample :
> 1. create file 'a' at cifs client.
> 2. rm 'a' and touch 'b a' at server.
> 3. ls -li 'a' at client, then client shows wrong(old) inode number.
>
> Bug link:
> https://bugzilla.kernel.org/show_bug.cgi?id=90021
>
>
>
> Signed-off-by: Nakajima Akira 
> diff -uprN -X linux-3.18-vanilla/Documentation/dontdiff linux-3.18-vanilla/fs/cifs/inode.c linux-3.18/fs/cifs/inode.c
> --- linux-3.18-vanilla/fs/cifs/inode.c  2014-12-08 07:21:05.000000000 +0900
> +++ linux-3.18/fs/cifs/inode.c  2014-12-19 11:07:59.127000000 +0900
> @@ -402,9 +402,18 @@ int cifs_get_inode_info_unix(struct inod
>                         rc = -ENOMEM;
>         } else {
>                 /* we already have inode, update it */
> +
> +               /* if uniqueid is different, return error */
> +               if (unlikely(cifs_sb->mnt_cifs_flags & CIFS_MOUNT_SERVER_INUM &&
> +                   CIFS_I(*pinode)->uniqueid != fattr.cf_uniqueid)) {
> +                       rc = -ENOENT;
> +                       goto cgiiu_exit;
> +               }
> +
>                 cifs_fattr_to_inode(*pinode, &fattr);
>         }
>
> +cgiiu_exit:
>         return rc;
>  }
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-cifs" in
> the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

This message from: http://www.mailbrowse.com/linux-cifs/10386.html
Previous message: Re: [linux-cifs-client] [PATCH] cifs: hard mount option behaviour implementation
Next message:Re: [PATCH 2/2] cifs: don't add dot and dotdot entry by default at the start of cifs_readdir