[2633] | 1 | From 097b5d31bcc325c7e33b1dcdf586c7b77bd00cbe Mon Sep 17 00:00:00 2001 |
---|
| 2 | From: Anders Kaseorg <andersk@mit.edu> |
---|
| 3 | Date: Sun, 12 Oct 2014 22:21:40 -0400 |
---|
| 4 | Subject: [PATCH] Revert "LINUX: Drop dentry if lookup returns new file" and |
---|
| 5 | log differences |
---|
| 6 | |
---|
| 7 | This reverts commit 81f1814b566cb3b1cda97be4c48b9788cd7addd0, and adds |
---|
| 8 | a warning message whenever it would have taken effect on a directory. |
---|
| 9 | |
---|
| 10 | Change-Id: I60e3a5feb49329b07c07b09edeb4b3c416faaac1 |
---|
| 11 | --- |
---|
| 12 | src/afs/LINUX/osi_vnodeops.c | 22 +++++++++++++++------- |
---|
| 13 | 1 file changed, 15 insertions(+), 7 deletions(-) |
---|
| 14 | |
---|
| 15 | diff --git a/src/afs/LINUX/osi_vnodeops.c b/src/afs/LINUX/osi_vnodeops.c |
---|
| 16 | index 2a8253e..6f0bbfb 100644 |
---|
| 17 | --- a/src/afs/LINUX/osi_vnodeops.c |
---|
| 18 | +++ b/src/afs/LINUX/osi_vnodeops.c |
---|
| 19 | @@ -1245,14 +1245,22 @@ afs_linux_dentry_revalidate(struct dentry *dp, int flags) |
---|
| 20 | code = afs_lookup(pvcp, (char *)dp->d_name.name, &tvc, credp); |
---|
| 21 | if (!tvc || tvc != vcp) { |
---|
| 22 | dput(parent); |
---|
| 23 | - /* Force unhash; the name doesn't point to this file |
---|
| 24 | - * anymore. */ |
---|
| 25 | - force_drop = 1; |
---|
| 26 | - if (code && code != ENOENT) { |
---|
| 27 | - /* ...except if we couldn't perform the actual lookup, |
---|
| 28 | - * we don't know if the name points to this file or not. */ |
---|
| 29 | - force_drop = 0; |
---|
| 30 | + /* Force unhash if name is known not to exist. */ |
---|
| 31 | + if (code == ENOENT) |
---|
| 32 | + force_drop = 1; |
---|
| 33 | + |
---|
| 34 | + if (code == 0) { |
---|
| 35 | + /* As of http://gerrit.openafs.org/11358, upstream |
---|
| 36 | + * also sets force_drop = 1 in the code == 0 case, |
---|
| 37 | + * but that seems to exacerbate the getcwd() |
---|
| 38 | + * ENOENT problem. */ |
---|
| 39 | + if (dp->d_inode && S_ISDIR(dp->d_inode->i_mode)) { |
---|
| 40 | + char buf[256]; |
---|
| 41 | + char *path = dentry_path_raw(dp, buf, sizeof(buf)); |
---|
| 42 | + pr_warn("openafs: Rescued directory /afs/%s from force_drop\n", IS_ERR(path) ? "(error)" : path); |
---|
| 43 | + } |
---|
| 44 | } |
---|
| 45 | + |
---|
| 46 | goto bad_dentry; |
---|
| 47 | } |
---|
| 48 | |
---|
| 49 | -- |
---|
| 50 | 2.1.2 |
---|
| 51 | |
---|