From: Boaz Harrosh <bharrosh@panasas.com>
To: Jan Kara <jack@suse.cz>
Cc: Al Viro <viro@ZenIV.linux.org.uk>, Ted Tso <tytso@mit.edu>,
<linux-ext4@vger.kernel.org>, <linux-fsdevel@vger.kernel.org>
Subject: [PATCH 5/4] exofs: Handle error from d_splice_alias()
Date: Wed, 30 May 2012 13:39:08 +0300 [thread overview]
Message-ID: <4FC5F8CC.20400@panasas.com> (raw)
In-Reply-To: <1338322067-17566-1-git-send-email-jack@suse.cz>
When directory hierarchy is corrupted and contains cycles, d_splice_alias() can
fail. Handle the failure cleanly.
Identical/coppied from:
ext2: Handle error from d_splice_alias()
Signed-off-by: Jan Kara <jack@suse.cz>
[exofs is just yet another copy/paste of ext2 code]
Signed-off-by: Boaz Harrosh <bharrosh@panasas.com>
---
fs/exofs/namei.c | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/fs/exofs/namei.c b/fs/exofs/namei.c
index fc7161d..82de452 100644
--- a/fs/exofs/namei.c
+++ b/fs/exofs/namei.c
@@ -50,13 +50,19 @@ static struct dentry *exofs_lookup(struct inode *dir, struct dentry *dentry,
{
struct inode *inode;
ino_t ino;
+ struct dentry *ret;
if (dentry->d_name.len > EXOFS_NAME_LEN)
return ERR_PTR(-ENAMETOOLONG);
ino = exofs_inode_by_name(dir, dentry);
inode = ino ? exofs_iget(dir->i_sb, ino) : NULL;
- return d_splice_alias(inode, dentry);
+ ret = d_splice_alias(inode, dentry);
+ if (IS_ERR(ret)) {
+ EXOFS_ERR("directory #%lu corrupted", dir->i_ino);
+ iput(inode);
+ }
+ return ret;
}
static int exofs_create(struct inode *dir, struct dentry *dentry, umode_t mode,
--
1.7.10.2.677.gb6bc67f
next prev parent reply other threads:[~2012-05-30 10:45 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-05-29 20:07 [PATCH 0/4] Avoid deadlock when corrupted directory creates a loop Jan Kara
2012-05-29 20:07 ` [PATCH 1/4] vfs: Avoid creation of directory loops for corrupted filesystems Jan Kara
2012-05-29 20:07 ` [PATCH 2/4] ext2: Handle error from d_splice_alias() Jan Kara
2012-05-29 20:07 ` [PATCH 3/4] ext3: " Jan Kara
2012-05-29 20:07 ` [PATCH 4/4] ext4: " Jan Kara
2012-05-30 10:39 ` Boaz Harrosh [this message]
2012-05-30 10:40 ` [PATCH 5/4] exofs: " Boaz Harrosh
2012-06-08 21:59 ` Al Viro
2012-06-11 15:41 ` Boaz Harrosh
2012-06-11 19:01 ` Ted Ts'o
2012-06-12 9:04 ` Jan Kara
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4FC5F8CC.20400@panasas.com \
--to=bharrosh@panasas.com \
--cc=jack@suse.cz \
--cc=linux-ext4@vger.kernel.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=tytso@mit.edu \
--cc=viro@ZenIV.linux.org.uk \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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.