diff --git a/fs/namei.c b/fs/namei.c index 5a9291c318815b1b53f770be9af7e92bad263e3a..ffab2e06e1472eca41449cbe5d8fe22baa219d29 100644 --- a/fs/namei.c +++ b/fs/namei.c @@ -3077,7 +3077,7 @@ static int do_last(struct nameidata *nd, struct path *path, error = -ENOTDIR; if ((nd->flags & LOOKUP_DIRECTORY) && !d_can_lookup(nd->path.dentry)) goto out; - if (!S_ISREG(nd->inode->i_mode)) + if (!d_is_reg(nd->path.dentry)) will_truncate = false; if (will_truncate) {