From: Jan Kara <jack@suse.cz>
To: Al Viro <viro@ZenIV.linux.org.uk>
Cc: linux-fsdevel@vger.kernel.org, Jan Kara <jack@suse.cz>
Subject: [PATCH 2/5] ext2: Handle error from d_splice_alias()
Date: Wed, 20 Jun 2012 22:58:37 +0200 [thread overview]
Message-ID: <1340225920-29379-2-git-send-email-jack@suse.cz> (raw)
In-Reply-To: <1340225920-29379-1-git-send-email-jack@suse.cz>
When directory hiearchy is corrupted and contains cycles, d_splice_alias() can
fail. Warn user and mark filesystem as with errors when that happens.
Signed-off-by: Jan Kara <jack@suse.cz>
---
fs/ext2/namei.c | 8 +++++++-
1 files changed, 7 insertions(+), 1 deletions(-)
diff --git a/fs/ext2/namei.c b/fs/ext2/namei.c
index f663a67..b3f074b 100644
--- a/fs/ext2/namei.c
+++ b/fs/ext2/namei.c
@@ -59,6 +59,7 @@ static struct dentry *ext2_lookup(struct inode * dir, struct dentry *dentry, str
{
struct inode * inode;
ino_t ino;
+ struct dentry *ret;
if (dentry->d_name.len > EXT2_NAME_LEN)
return ERR_PTR(-ENAMETOOLONG);
@@ -74,7 +75,12 @@ static struct dentry *ext2_lookup(struct inode * dir, struct dentry *dentry, str
return ERR_PTR(-EIO);
}
}
- return d_splice_alias(inode, dentry);
+ ret = d_splice_alias(inode, dentry);
+ if (IS_ERR(ret)) {
+ ext2_error(dir->i_sb, __func__, "directory #%lu corrupted",
+ dir->i_ino);
+ }
+ return ret;
}
struct dentry *ext2_get_parent(struct dentry *child)
--
1.7.1
next prev parent reply other threads:[~2012-06-20 20:58 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-06-20 20:58 [PATCH 1/5 v2] vfs: Avoid creation of directory loops for corrupted filesystems Jan Kara
2012-06-20 20:58 ` Jan Kara [this message]
2012-06-20 20:58 ` [PATCH 3/5] ext3: Handle error from d_splice_alias() Jan Kara
2012-06-20 20:58 ` [PATCH 4/5] ext4: " Jan Kara
2012-06-20 20:58 ` [PATCH 5/5] exofs: " Jan Kara
2012-06-28 8:30 ` [PATCH 1/5 v2] vfs: Avoid creation of directory loops for corrupted filesystems 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=1340225920-29379-2-git-send-email-jack@suse.cz \
--to=jack@suse.cz \
--cc=linux-fsdevel@vger.kernel.org \
--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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).