OSDN Git Service

afs: get rid of redundant ->d_name.len checks
authorAl Viro <viro@zeniv.linux.org.uk>
Sat, 3 Aug 2013 08:09:34 +0000 (12:09 +0400)
committerAl Viro <viro@zeniv.linux.org.uk>
Sat, 7 Sep 2013 23:54:55 +0000 (19:54 -0400)
No dentry can get to directory modification methods without
having passed either ->lookup() or ->atomic_open(); if name is
rejected by those two (or by ->d_hash()) with an error, it won't
be seen by anything else.

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
fs/afs/dir.c

index 0b74d31..646337d 100644 (file)
@@ -751,10 +751,6 @@ static int afs_mkdir(struct inode *dir, struct dentry *dentry, umode_t mode)
        _enter("{%x:%u},{%s},%ho",
               dvnode->fid.vid, dvnode->fid.vnode, dentry->d_name.name, mode);
 
-       ret = -ENAMETOOLONG;
-       if (dentry->d_name.len >= AFSNAMEMAX)
-               goto error;
-
        key = afs_request_key(dvnode->volume->cell);
        if (IS_ERR(key)) {
                ret = PTR_ERR(key);
@@ -816,10 +812,6 @@ static int afs_rmdir(struct inode *dir, struct dentry *dentry)
        _enter("{%x:%u},{%s}",
               dvnode->fid.vid, dvnode->fid.vnode, dentry->d_name.name);
 
-       ret = -ENAMETOOLONG;
-       if (dentry->d_name.len >= AFSNAMEMAX)
-               goto error;
-
        key = afs_request_key(dvnode->volume->cell);
        if (IS_ERR(key)) {
                ret = PTR_ERR(key);
@@ -936,10 +928,6 @@ static int afs_create(struct inode *dir, struct dentry *dentry, umode_t mode,
        _enter("{%x:%u},{%s},%ho,",
               dvnode->fid.vid, dvnode->fid.vnode, dentry->d_name.name, mode);
 
-       ret = -ENAMETOOLONG;
-       if (dentry->d_name.len >= AFSNAMEMAX)
-               goto error;
-
        key = afs_request_key(dvnode->volume->cell);
        if (IS_ERR(key)) {
                ret = PTR_ERR(key);
@@ -1005,10 +993,6 @@ static int afs_link(struct dentry *from, struct inode *dir,
               dvnode->fid.vid, dvnode->fid.vnode,
               dentry->d_name.name);
 
-       ret = -ENAMETOOLONG;
-       if (dentry->d_name.len >= AFSNAMEMAX)
-               goto error;
-
        key = afs_request_key(dvnode->volume->cell);
        if (IS_ERR(key)) {
                ret = PTR_ERR(key);
@@ -1053,10 +1037,6 @@ static int afs_symlink(struct inode *dir, struct dentry *dentry,
               dvnode->fid.vid, dvnode->fid.vnode, dentry->d_name.name,
               content);
 
-       ret = -ENAMETOOLONG;
-       if (dentry->d_name.len >= AFSNAMEMAX)
-               goto error;
-
        ret = -EINVAL;
        if (strlen(content) >= AFSPATHMAX)
                goto error;
@@ -1127,10 +1107,6 @@ static int afs_rename(struct inode *old_dir, struct dentry *old_dentry,
               new_dvnode->fid.vid, new_dvnode->fid.vnode,
               new_dentry->d_name.name);
 
-       ret = -ENAMETOOLONG;
-       if (new_dentry->d_name.len >= AFSNAMEMAX)
-               goto error;
-
        key = afs_request_key(orig_dvnode->volume->cell);
        if (IS_ERR(key)) {
                ret = PTR_ERR(key);