diff --git a/fs/minix/namei.c b/fs/minix/namei.c index e245f55a68ff..a4caaa3f7c9a 100644 --- a/fs/minix/namei.c +++ b/fs/minix/namei.c @@ -393,12 +393,23 @@ const char *minix_get_link(struct dentry *dentry, struct inode *inode, else blk = v2_block_to_cpu(*(v2_i_data(inode))); - bh = sb_bread(sb, blk); - if (IS_ERR(bh)) - return ERR_CAST(bh); - if (!bh) { - pr_err("bad symlink on inode %llu", inode->i_ino); - return ERR_PTR(-EFSCORRUPTED); + /* This tried dodging the dentry check that ext4 does, but it turns out + * that it's necessary after all. + */ + if (!dentry) { + bh = sb_getblk(sb, blk); + if (!bh || !buffer_uptodate(bh)) { + brelse(bh); + return ERR_PTR(-ECHILD); + } + } else { + bh = sb_bread(sb, blk); + if (IS_ERR(bh)) + return ERR_CAST(bh); + if (!bh) { + pr_err("bad symlink on inode %llu", inode->i_ino); + return ERR_PTR(-EFSCORRUPTED); + } } set_delayed_call(callback, minix_free_link, bh);