From mboxrd@z Thu Jan 1 00:00:00 1970 From: Jan Kara Subject: [PATCH 5/5] exofs: Handle error from d_splice_alias() Date: Wed, 20 Jun 2012 22:58:40 +0200 Message-ID: <1340225920-29379-5-git-send-email-jack@suse.cz> References: <1340225920-29379-1-git-send-email-jack@suse.cz> Cc: linux-fsdevel@vger.kernel.org, Boaz Harrosh , Jan Kara To: Al Viro Return-path: Received: from cantor2.suse.de ([195.135.220.15]:43462 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753995Ab2FTU6n (ORCPT ); Wed, 20 Jun 2012 16:58:43 -0400 In-Reply-To: <1340225920-29379-1-git-send-email-jack@suse.cz> Sender: linux-fsdevel-owner@vger.kernel.org List-ID: From: Boaz Harrosh When directory hierarchy is corrupted and contains cycles, d_splice_alias() can fail. Warn user if that happens. Signed-off-by: Boaz Harrosh Signed-off-by: Jan Kara --- fs/exofs/namei.c | 6 +++++- 1 files changed, 5 insertions(+), 1 deletions(-) diff --git a/fs/exofs/namei.c b/fs/exofs/namei.c index fc7161d..6f44d3c 100644 --- a/fs/exofs/namei.c +++ b/fs/exofs/namei.c @@ -50,13 +50,17 @@ 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); + return ret; } static int exofs_create(struct inode *dir, struct dentry *dentry, umode_t mode, -- 1.7.1