All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] cifs: When "refer file directly", make new inode cache if "uniqueid is different"
@ 2014-12-24  2:27 Nakajima Akira
       [not found] ` <549A249A.3080000-o7dWnD6vFTHqq2nvvmkE/A@public.gmane.org>
  0 siblings, 1 reply; 11+ messages in thread
From: Nakajima Akira @ 2014-12-24  2:27 UTC (permalink / raw)
  To: linux-cifs-u79uwXL29TY76Z2rM5mHXA@public.gmane.org

When refer file "directly" (e.g. ls -li <filename>),
 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 <nakajima.akira-o7dWnD6vFTHqq2nvvmkE/A@public.gmane.org>
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;
 }
 

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

end of thread, other threads:[~2015-05-20 18:06 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-12-24  2:27 [PATCH] cifs: When "refer file directly", make new inode cache if "uniqueid is different" Nakajima Akira
     [not found] ` <549A249A.3080000-o7dWnD6vFTHqq2nvvmkE/A@public.gmane.org>
2015-01-04  5:34   ` Shirish Pargaonkar
2015-04-07 10:45   ` Jeff Layton
     [not found]     ` <20150407064551.36374c43-9yPaYZwiELC+kQycOl6kW4xkIHaj4LzF@public.gmane.org>
2015-04-07 14:39       ` Steve French
     [not found]         ` <CAH2r5ms5wn1ii563gK=+=koeQEmy5gY=xTP+Y8_GGjyPJwznzQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2015-04-09  8:07           ` Nakajima Akira
     [not found]             ` <5526335C.3030701-o7dWnD6vFTHqq2nvvmkE/A@public.gmane.org>
2015-04-10 13:16               ` Jeff Layton
     [not found]                 ` <20150410091647.39fb6515-08S845evdOaAjSkqwZiSMmfYqLom42DlXqFh9Ls21Oc@public.gmane.org>
2015-04-13  4:24                   ` Shirish Pargaonkar
     [not found]                     ` <CADT32eK6Zb7arYFyCPc+yt509P3pgg65bModxgNLyN1vb-a2-w-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2015-04-13 20:42                       ` Jeff Layton
     [not found]                         ` <20150413164235.2f4bd67b-08S845evdOaAjSkqwZiSMmfYqLom42DlXqFh9Ls21Oc@public.gmane.org>
2015-04-22  6:31                           ` Nakajima Akira
2015-04-22 15:43                             ` Fwd: " Steve French
     [not found]                             ` <55374057.6010908-o7dWnD6vFTHqq2nvvmkE/A@public.gmane.org>
2015-05-20 18:06                               ` Steve French

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.