Messages in this thread Patch in this message | | | Date | Wed, 16 Jun 2010 14:59:13 -0400 | From | Valerie Aurora <> | Subject | [PATCH] d_ino considered harmful |
| |
Who needs d_ino anyway? I am running a kernel with this patch - Gnome, a browser, IRC, kernel compile, etc. and everything works.
-VAL
commit 184f3919d0071f3bfa40010aa6919ea89999d79b Author: Valerie Aurora <vaurora@redhat.com> Date: Wed Jun 16 11:05:06 2010 -0700
VFS: Always return 0 for d_ino Use of d_ino without the corresponding st_dev is always buggy in the presence of submounts, bind mounts, and union mounts. E.g., the d_ino of a mountpoint will be the inode number of the directory under the mountpoint, not the mounted directory. Correct code must call stat(), which returns the correct device ID and inode in st_dev and st_ino. Since no one should be using d_ino anyway, always return 0 to detect bugs.
diff --git a/fs/readdir.c b/fs/readdir.c index dd3eae1..38ea772 100644 --- a/fs/readdir.c +++ b/fs/readdir.c @@ -91,7 +91,9 @@ static int fillonedir(void * __buf, const char * name, int namlen, loff_t offset if (buf->result) return -EINVAL; - d_ino = ino; + /* Use of d_ino without st_dev is always buggy. */ + d_ino = 0; + if (sizeof(d_ino) < sizeof(ino) && d_ino != ino) { buf->result = -EOVERFLOW; return -EOVERFLOW;
| |