]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/commitdiff
a .25 patch
authorGreg Kroah-Hartman <gregkh@suse.de>
Mon, 4 Aug 2008 19:39:11 +0000 (12:39 -0700)
committerGreg Kroah-Hartman <gregkh@suse.de>
Mon, 4 Aug 2008 19:39:11 +0000 (12:39 -0700)
queue-2.6.25/series
queue-2.6.25/vfs-fix-lookup-on-deleted-directory.patch [new file with mode: 0644]

index 7bae7445ac60032a7a9d270d76f8d459a4877b33..e0a2425ecc18f8dd922809381b791f92bb094e24 100644 (file)
@@ -30,3 +30,4 @@ alsa-emu10k1-fix-inverted-analog-digital-mixer-switch-on-audigy2.patch
 alsa-fix-oops-with-usb-audio-reconnection.patch
 alsa-hda-add-missing-thinkpad-z60m-support.patch
 alsa-hda-fix-wrong-volumes-in-ad1988-auto-probe-mode.patch
+vfs-fix-lookup-on-deleted-directory.patch
diff --git a/queue-2.6.25/vfs-fix-lookup-on-deleted-directory.patch b/queue-2.6.25/vfs-fix-lookup-on-deleted-directory.patch
new file mode 100644 (file)
index 0000000..0171b12
--- /dev/null
@@ -0,0 +1,76 @@
+From d70b67c8bc72ee23b55381bd6a884f4796692f77 Mon Sep 17 00:00:00 2001
+From: Miklos Szeredi <mszeredi@suse.cz>
+Date: Wed, 2 Jul 2008 21:30:15 +0200
+Subject: vfs: fix lookup on deleted directory
+
+From: Miklos Szeredi <mszeredi@suse.cz>
+
+commit d70b67c8bc72ee23b55381bd6a884f4796692f77 upstream
+
+Lookup can install a child dentry for a deleted directory.  This keeps
+the directory dentry alive, and the inode pinned in the cache and on
+disk, even after all external references have gone away.
+
+This isn't a big problem normally, since memory pressure or umount
+will clear out the directory dentry and its children, releasing the
+inode.  But for UBIFS this causes problems because its orphan area can
+overflow.
+
+Fix this by returning ENOENT for all lookups on a S_DEAD directory
+before creating a child dentry.
+
+Thanks to Zoltan Sogor for noticing this while testing UBIFS, and
+Artem for the excellent analysis of the problem and testing.
+
+Reported-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
+Tested-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
+Signed-off-by: Miklos Szeredi <mszeredi@suse.cz>
+Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
+Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
+
+---
+ fs/namei.c |   19 +++++++++++++++++--
+ 1 file changed, 17 insertions(+), 2 deletions(-)
+
+--- a/fs/namei.c
++++ b/fs/namei.c
+@@ -514,7 +514,14 @@ static struct dentry * real_lookup(struc
+        */
+       result = d_lookup(parent, name);
+       if (!result) {
+-              struct dentry * dentry = d_alloc(parent, name);
++              struct dentry *dentry;
++
++              /* Don't create child dentry for a dead directory. */
++              result = ERR_PTR(-ENOENT);
++              if (IS_DEADDIR(dir))
++                      goto out_unlock;
++
++              dentry = d_alloc(parent, name);
+               result = ERR_PTR(-ENOMEM);
+               if (dentry) {
+                       result = dir->i_op->lookup(dir, dentry, nd);
+@@ -523,6 +530,7 @@ static struct dentry * real_lookup(struc
+                       else
+                               result = dentry;
+               }
++out_unlock:
+               mutex_unlock(&dir->i_mutex);
+               return result;
+       }
+@@ -1313,7 +1321,14 @@ static struct dentry *__lookup_hash(stru
+       dentry = cached_lookup(base, name, nd);
+       if (!dentry) {
+-              struct dentry *new = d_alloc(base, name);
++              struct dentry *new;
++
++              /* Don't create child dentry for a dead directory. */
++              dentry = ERR_PTR(-ENOENT);
++              if (IS_DEADDIR(inode))
++                      goto out;
++
++              new = d_alloc(base, name);
+               dentry = ERR_PTR(-ENOMEM);
+               if (!new)
+                       goto out;