Patchwork [BUG:845] stat-prefetch: Remove checks for loc->parent

login
register
Submitter Shehjar Tikoo
Date 2010-04-22 11:42:00
Message ID <1271936520-7377-1-git-send-email-shehjart@gluster.com>
Download mbox | patch
Permalink /patch/3157/
State Accepted
Headers show

Comments

Shehjar Tikoo - 2010-04-22 11:42:00
From: Shehjar Tikoo <shehjart@gluster.com>

..because loc->parent can be NULL for the root inode.
Having this check makes sp return EINVAL on perfectly valid
fops.

Signed-off-by: Shehjar Tikoo <shehjart@gluster.com>
---
 .../performance/stat-prefetch/src/stat-prefetch.c  |   32 --------------------
 1 files changed, 0 insertions(+), 32 deletions(-)
Shehjar Tikoo - 2010-04-22 11:44:02
Like I said in the bug report, I am using this patch as a temporary fix 
for the nfs-beta branch. If this is the proper fix, please feel free to 
commit once Raghu OKs it.

Thanks
-Shehjar

shehjart@gluster.com wrote:
> From: Shehjar Tikoo <shehjart@gluster.com>
> 
> ..because loc->parent can be NULL for the root inode.
> Having this check makes sp return EINVAL on perfectly valid
> fops.
> 
> Signed-off-by: Shehjar Tikoo <shehjart@gluster.com>
> ---
>  .../performance/stat-prefetch/src/stat-prefetch.c  |   32 --------------------
>  1 files changed, 0 insertions(+), 32 deletions(-)
> 
> diff --git a/xlators/performance/stat-prefetch/src/stat-prefetch.c b/xlators/performance/stat-prefetch/src/stat-prefetch.c
> index c540421..da07aa1 100644
> --- a/xlators/performance/stat-prefetch/src/stat-prefetch.c
> +++ b/xlators/performance/stat-prefetch/src/stat-prefetch.c
> @@ -1436,8 +1436,6 @@ sp_create (call_frame_t *frame,	xlator_t *this,	loc_t *loc, int32_t flags,
>  
>          GF_VALIDATE_OR_GOTO_WITH_ERROR (this->name, loc, out, op_errno,
>                                          EINVAL);
> -        GF_VALIDATE_OR_GOTO_WITH_ERROR (this->name, loc->parent, out,
> -                                        op_errno, EINVAL);
>          GF_VALIDATE_OR_GOTO_WITH_ERROR (this->name, loc->path, out, op_errno,
>                                          EINVAL);
>          GF_VALIDATE_OR_GOTO_WITH_ERROR (this->name, loc->name, out, op_errno,
> @@ -1626,8 +1624,6 @@ sp_mkdir (call_frame_t *frame, xlator_t *this, loc_t *loc, mode_t mode)
>  
>          GF_VALIDATE_OR_GOTO_WITH_ERROR (this->name, loc, out, op_errno,
>                                          EINVAL);
> -        GF_VALIDATE_OR_GOTO_WITH_ERROR (this->name, loc->parent, out,
> -                                        op_errno, EINVAL);
>          GF_VALIDATE_OR_GOTO_WITH_ERROR (this->name, loc->path, out, op_errno,
>                                          EINVAL);
>          GF_VALIDATE_OR_GOTO_WITH_ERROR (this->name, loc->name, out, op_errno,
> @@ -1689,8 +1685,6 @@ sp_mknod (call_frame_t *frame, xlator_t *this, loc_t *loc, mode_t mode,
>  
>          GF_VALIDATE_OR_GOTO_WITH_ERROR (this->name, loc, out, op_errno,
>                                          EINVAL);
> -        GF_VALIDATE_OR_GOTO_WITH_ERROR (this->name, loc->parent, out,
> -                                        op_errno, EINVAL);
>          GF_VALIDATE_OR_GOTO_WITH_ERROR (this->name, loc->path, out, op_errno,
>                                          EINVAL);
>          GF_VALIDATE_OR_GOTO_WITH_ERROR (this->name, loc->name, out, op_errno,
> @@ -1752,8 +1746,6 @@ sp_symlink (call_frame_t *frame, xlator_t *this, const char *linkpath,
>  
>          GF_VALIDATE_OR_GOTO_WITH_ERROR (this->name, loc, out, op_errno,
>                                          EINVAL);
> -        GF_VALIDATE_OR_GOTO_WITH_ERROR (this->name, loc->parent, out,
> -                                        op_errno, EINVAL);
>          GF_VALIDATE_OR_GOTO_WITH_ERROR (this->name, loc->path, out, op_errno,
>                                          EINVAL);
>          GF_VALIDATE_OR_GOTO_WITH_ERROR (this->name, loc->name, out, op_errno,
> @@ -1867,8 +1859,6 @@ sp_link (call_frame_t *frame, xlator_t *this, loc_t *oldloc, loc_t *newloc)
>  
>          GF_VALIDATE_OR_GOTO_WITH_ERROR (this->name, newloc, out, op_errno,
>                                          EINVAL);
> -        GF_VALIDATE_OR_GOTO_WITH_ERROR (this->name, newloc->parent, out,
> -                                        op_errno, EINVAL);
>          GF_VALIDATE_OR_GOTO_WITH_ERROR (this->name, newloc->path, out,
>                                          op_errno, EINVAL);
>          GF_VALIDATE_OR_GOTO_WITH_ERROR (this->name, newloc->name, out,
> @@ -1876,8 +1866,6 @@ sp_link (call_frame_t *frame, xlator_t *this, loc_t *oldloc, loc_t *newloc)
>          GF_VALIDATE_OR_GOTO_WITH_ERROR (this->name, newloc->inode, out,
>                                          op_errno, EINVAL);
>  
> -        GF_VALIDATE_OR_GOTO_WITH_ERROR (this->name, oldloc->parent, out,
> -                                        op_errno, EINVAL);
>          GF_VALIDATE_OR_GOTO_WITH_ERROR (this->name, oldloc->name, out,
>                                          op_errno, EINVAL);
>  
> @@ -1973,8 +1961,6 @@ sp_truncate (call_frame_t *frame, xlator_t *this, loc_t *loc, off_t offset)
>  
>          GF_VALIDATE_OR_GOTO_WITH_ERROR (this->name, loc, out, op_errno,
>                                          EINVAL);
> -        GF_VALIDATE_OR_GOTO_WITH_ERROR (this->name, loc->parent, out,
> -                                        op_errno, EINVAL);
>          GF_VALIDATE_OR_GOTO_WITH_ERROR (this->name, loc->name, out, op_errno,
>                                          EINVAL);
>  
> @@ -2109,8 +2095,6 @@ sp_setattr (call_frame_t *frame, xlator_t *this,
>  
>          GF_VALIDATE_OR_GOTO_WITH_ERROR (this->name, loc, out, op_errno,
>                                          EINVAL);
> -        GF_VALIDATE_OR_GOTO_WITH_ERROR (this->name, loc->parent, out,
> -                                        op_errno, EINVAL);
>          GF_VALIDATE_OR_GOTO_WITH_ERROR (this->name, loc->name, out, op_errno,
>                                          EINVAL);
>  
> @@ -2208,8 +2192,6 @@ sp_readlink (call_frame_t *frame, xlator_t *this, loc_t *loc, size_t size)
>  
>          GF_VALIDATE_OR_GOTO_WITH_ERROR (this->name, loc, out, op_errno,
>                                          EINVAL);
> -        GF_VALIDATE_OR_GOTO_WITH_ERROR (this->name, loc->parent, out,
> -                                        op_errno, EINVAL);
>          GF_VALIDATE_OR_GOTO_WITH_ERROR (this->name, loc->name, out,
>                                          op_errno, EINVAL);
>  
> @@ -2317,8 +2299,6 @@ sp_unlink (call_frame_t *frame, xlator_t *this, loc_t *loc)
>  
>          GF_VALIDATE_OR_GOTO_WITH_ERROR (this->name, loc, out, op_errno,
>                                          EINVAL);
> -        GF_VALIDATE_OR_GOTO_WITH_ERROR (this->name, loc->parent, out,
> -                                        op_errno, EINVAL);
>          GF_VALIDATE_OR_GOTO_WITH_ERROR (this->name, loc->name, out, op_errno,
>                                          EINVAL);
>  
> @@ -2439,8 +2419,6 @@ sp_rmdir (call_frame_t *frame, xlator_t *this, loc_t *loc)
>                                          EINVAL);
>          GF_VALIDATE_OR_GOTO_WITH_ERROR (this->name, loc->inode, out,
>                                          op_errno, EINVAL);
> -        GF_VALIDATE_OR_GOTO_WITH_ERROR (this->name, loc->parent, out,
> -                                        op_errno, EINVAL);
>  
>          sp_remove_caches_from_all_fds_opened (this, loc->inode);
>  
> @@ -2718,8 +2696,6 @@ sp_rename (call_frame_t *frame, xlator_t *this, loc_t *oldloc,loc_t *newloc)
>                                          op_errno, EINVAL);
>          GF_VALIDATE_OR_GOTO_WITH_ERROR (this->name, oldloc->name, out,
>                                          op_errno, EINVAL);
> -        GF_VALIDATE_OR_GOTO_WITH_ERROR (this->name, oldloc->parent, out,
> -                                        op_errno, EINVAL);
>          GF_VALIDATE_OR_GOTO_WITH_ERROR (this->name, oldloc->inode, out,
>                                          op_errno, EINVAL);
>  
> @@ -2891,8 +2867,6 @@ sp_setxattr (call_frame_t *frame, xlator_t *this, loc_t *loc, dict_t *dict,
>  
>          GF_VALIDATE_OR_GOTO_WITH_ERROR (this->name, loc, out, op_errno,
>                                          EINVAL);
> -        GF_VALIDATE_OR_GOTO_WITH_ERROR (this->name, loc->parent, out,
> -                                        op_errno, EINVAL);
>          GF_VALIDATE_OR_GOTO_WITH_ERROR (this->name, loc->name, out, op_errno,
>                                          EINVAL);
>  
> @@ -2982,8 +2956,6 @@ sp_removexattr (call_frame_t *frame, xlator_t *this, loc_t *loc,
>  
>          GF_VALIDATE_OR_GOTO_WITH_ERROR (this->name, loc, out, op_errno,
>                                          EINVAL);
> -        GF_VALIDATE_OR_GOTO_WITH_ERROR (this->name, loc->parent, out,
> -                                        op_errno, EINVAL);
>          GF_VALIDATE_OR_GOTO_WITH_ERROR (this->name, loc->name, out, op_errno,
>                                          EINVAL);
>  
> @@ -3170,8 +3142,6 @@ sp_checksum (call_frame_t *frame, xlator_t *this, loc_t *loc, int32_t flag)
>  
>          GF_VALIDATE_OR_GOTO_WITH_ERROR (this->name, loc, out, op_errno,
>                                          EINVAL);
> -        GF_VALIDATE_OR_GOTO_WITH_ERROR (this->name, loc->parent, out,
> -                                        op_errno, EINVAL);
>          GF_VALIDATE_OR_GOTO_WITH_ERROR (this->name, loc->name, out,
>                                          op_errno, EINVAL);
>  
> @@ -3269,8 +3239,6 @@ sp_xattrop (call_frame_t *frame, xlator_t *this, loc_t *loc,
>  
>          GF_VALIDATE_OR_GOTO_WITH_ERROR (this->name, loc, out, op_errno,
>                                          EINVAL);
> -        GF_VALIDATE_OR_GOTO_WITH_ERROR (this->name, loc->parent, out,
> -                                        op_errno, EINVAL);
>          GF_VALIDATE_OR_GOTO_WITH_ERROR (this->name, loc->name, out, op_errno,
>                                          EINVAL);
>
Amar Tumballi - 2010-04-22 14:00:56
On Thu, Apr 22, 2010 at 5:14 PM, Shehjar Tikoo <shehjart@gluster.com> wrote:

> Like I said in the bug report, I am using this patch as a temporary fix for
> the nfs-beta branch. If this is the proper fix, please feel free to commit
> once Raghu OKs it.
>
> Thanks
> -Shehjar
>
>
loc->parent check can remain for mkdir, mknod, symlink, create, link as in
its case '/' will never be coming in 'loc'.

Regards,

Patch

diff --git a/xlators/performance/stat-prefetch/src/stat-prefetch.c b/xlators/performance/stat-prefetch/src/stat-prefetch.c
index c540421..da07aa1 100644
--- a/xlators/performance/stat-prefetch/src/stat-prefetch.c
+++ b/xlators/performance/stat-prefetch/src/stat-prefetch.c
@@ -1436,8 +1436,6 @@  sp_create (call_frame_t *frame,	xlator_t *this,	loc_t *loc, int32_t flags,
 
         GF_VALIDATE_OR_GOTO_WITH_ERROR (this->name, loc, out, op_errno,
                                         EINVAL);
-        GF_VALIDATE_OR_GOTO_WITH_ERROR (this->name, loc->parent, out,
-                                        op_errno, EINVAL);
         GF_VALIDATE_OR_GOTO_WITH_ERROR (this->name, loc->path, out, op_errno,
                                         EINVAL);
         GF_VALIDATE_OR_GOTO_WITH_ERROR (this->name, loc->name, out, op_errno,
@@ -1626,8 +1624,6 @@  sp_mkdir (call_frame_t *frame, xlator_t *this, loc_t *loc, mode_t mode)
 
         GF_VALIDATE_OR_GOTO_WITH_ERROR (this->name, loc, out, op_errno,
                                         EINVAL);
-        GF_VALIDATE_OR_GOTO_WITH_ERROR (this->name, loc->parent, out,
-                                        op_errno, EINVAL);
         GF_VALIDATE_OR_GOTO_WITH_ERROR (this->name, loc->path, out, op_errno,
                                         EINVAL);
         GF_VALIDATE_OR_GOTO_WITH_ERROR (this->name, loc->name, out, op_errno,
@@ -1689,8 +1685,6 @@  sp_mknod (call_frame_t *frame, xlator_t *this, loc_t *loc, mode_t mode,
 
         GF_VALIDATE_OR_GOTO_WITH_ERROR (this->name, loc, out, op_errno,
                                         EINVAL);
-        GF_VALIDATE_OR_GOTO_WITH_ERROR (this->name, loc->parent, out,
-                                        op_errno, EINVAL);
         GF_VALIDATE_OR_GOTO_WITH_ERROR (this->name, loc->path, out, op_errno,
                                         EINVAL);
         GF_VALIDATE_OR_GOTO_WITH_ERROR (this->name, loc->name, out, op_errno,
@@ -1752,8 +1746,6 @@  sp_symlink (call_frame_t *frame, xlator_t *this, const char *linkpath,
 
         GF_VALIDATE_OR_GOTO_WITH_ERROR (this->name, loc, out, op_errno,
                                         EINVAL);
-        GF_VALIDATE_OR_GOTO_WITH_ERROR (this->name, loc->parent, out,
-                                        op_errno, EINVAL);
         GF_VALIDATE_OR_GOTO_WITH_ERROR (this->name, loc->path, out, op_errno,
                                         EINVAL);
         GF_VALIDATE_OR_GOTO_WITH_ERROR (this->name, loc->name, out, op_errno,
@@ -1867,8 +1859,6 @@  sp_link (call_frame_t *frame, xlator_t *this, loc_t *oldloc, loc_t *newloc)
 
         GF_VALIDATE_OR_GOTO_WITH_ERROR (this->name, newloc, out, op_errno,
                                         EINVAL);
-        GF_VALIDATE_OR_GOTO_WITH_ERROR (this->name, newloc->parent, out,
-                                        op_errno, EINVAL);
         GF_VALIDATE_OR_GOTO_WITH_ERROR (this->name, newloc->path, out,
                                         op_errno, EINVAL);
         GF_VALIDATE_OR_GOTO_WITH_ERROR (this->name, newloc->name, out,
@@ -1876,8 +1866,6 @@  sp_link (call_frame_t *frame, xlator_t *this, loc_t *oldloc, loc_t *newloc)
         GF_VALIDATE_OR_GOTO_WITH_ERROR (this->name, newloc->inode, out,
                                         op_errno, EINVAL);
 
-        GF_VALIDATE_OR_GOTO_WITH_ERROR (this->name, oldloc->parent, out,
-                                        op_errno, EINVAL);
         GF_VALIDATE_OR_GOTO_WITH_ERROR (this->name, oldloc->name, out,
                                         op_errno, EINVAL);
 
@@ -1973,8 +1961,6 @@  sp_truncate (call_frame_t *frame, xlator_t *this, loc_t *loc, off_t offset)
 
         GF_VALIDATE_OR_GOTO_WITH_ERROR (this->name, loc, out, op_errno,
                                         EINVAL);
-        GF_VALIDATE_OR_GOTO_WITH_ERROR (this->name, loc->parent, out,
-                                        op_errno, EINVAL);
         GF_VALIDATE_OR_GOTO_WITH_ERROR (this->name, loc->name, out, op_errno,
                                         EINVAL);
 
@@ -2109,8 +2095,6 @@  sp_setattr (call_frame_t *frame, xlator_t *this,
 
         GF_VALIDATE_OR_GOTO_WITH_ERROR (this->name, loc, out, op_errno,
                                         EINVAL);
-        GF_VALIDATE_OR_GOTO_WITH_ERROR (this->name, loc->parent, out,
-                                        op_errno, EINVAL);
         GF_VALIDATE_OR_GOTO_WITH_ERROR (this->name, loc->name, out, op_errno,
                                         EINVAL);
 
@@ -2208,8 +2192,6 @@  sp_readlink (call_frame_t *frame, xlator_t *this, loc_t *loc, size_t size)
 
         GF_VALIDATE_OR_GOTO_WITH_ERROR (this->name, loc, out, op_errno,
                                         EINVAL);
-        GF_VALIDATE_OR_GOTO_WITH_ERROR (this->name, loc->parent, out,
-                                        op_errno, EINVAL);
         GF_VALIDATE_OR_GOTO_WITH_ERROR (this->name, loc->name, out,
                                         op_errno, EINVAL);
 
@@ -2317,8 +2299,6 @@  sp_unlink (call_frame_t *frame, xlator_t *this, loc_t *loc)
 
         GF_VALIDATE_OR_GOTO_WITH_ERROR (this->name, loc, out, op_errno,
                                         EINVAL);
-        GF_VALIDATE_OR_GOTO_WITH_ERROR (this->name, loc->parent, out,
-                                        op_errno, EINVAL);
         GF_VALIDATE_OR_GOTO_WITH_ERROR (this->name, loc->name, out, op_errno,
                                         EINVAL);
 
@@ -2439,8 +2419,6 @@  sp_rmdir (call_frame_t *frame, xlator_t *this, loc_t *loc)
                                         EINVAL);
         GF_VALIDATE_OR_GOTO_WITH_ERROR (this->name, loc->inode, out,
                                         op_errno, EINVAL);
-        GF_VALIDATE_OR_GOTO_WITH_ERROR (this->name, loc->parent, out,
-                                        op_errno, EINVAL);
 
         sp_remove_caches_from_all_fds_opened (this, loc->inode);
 
@@ -2718,8 +2696,6 @@  sp_rename (call_frame_t *frame, xlator_t *this, loc_t *oldloc,loc_t *newloc)
                                         op_errno, EINVAL);
         GF_VALIDATE_OR_GOTO_WITH_ERROR (this->name, oldloc->name, out,
                                         op_errno, EINVAL);
-        GF_VALIDATE_OR_GOTO_WITH_ERROR (this->name, oldloc->parent, out,
-                                        op_errno, EINVAL);
         GF_VALIDATE_OR_GOTO_WITH_ERROR (this->name, oldloc->inode, out,
                                         op_errno, EINVAL);
 
@@ -2891,8 +2867,6 @@  sp_setxattr (call_frame_t *frame, xlator_t *this, loc_t *loc, dict_t *dict,
 
         GF_VALIDATE_OR_GOTO_WITH_ERROR (this->name, loc, out, op_errno,
                                         EINVAL);
-        GF_VALIDATE_OR_GOTO_WITH_ERROR (this->name, loc->parent, out,
-                                        op_errno, EINVAL);
         GF_VALIDATE_OR_GOTO_WITH_ERROR (this->name, loc->name, out, op_errno,
                                         EINVAL);
 
@@ -2982,8 +2956,6 @@  sp_removexattr (call_frame_t *frame, xlator_t *this, loc_t *loc,
 
         GF_VALIDATE_OR_GOTO_WITH_ERROR (this->name, loc, out, op_errno,
                                         EINVAL);
-        GF_VALIDATE_OR_GOTO_WITH_ERROR (this->name, loc->parent, out,
-                                        op_errno, EINVAL);
         GF_VALIDATE_OR_GOTO_WITH_ERROR (this->name, loc->name, out, op_errno,
                                         EINVAL);
 
@@ -3170,8 +3142,6 @@  sp_checksum (call_frame_t *frame, xlator_t *this, loc_t *loc, int32_t flag)
 
         GF_VALIDATE_OR_GOTO_WITH_ERROR (this->name, loc, out, op_errno,
                                         EINVAL);
-        GF_VALIDATE_OR_GOTO_WITH_ERROR (this->name, loc->parent, out,
-                                        op_errno, EINVAL);
         GF_VALIDATE_OR_GOTO_WITH_ERROR (this->name, loc->name, out,
                                         op_errno, EINVAL);
 
@@ -3269,8 +3239,6 @@  sp_xattrop (call_frame_t *frame, xlator_t *this, loc_t *loc,
 
         GF_VALIDATE_OR_GOTO_WITH_ERROR (this->name, loc, out, op_errno,
                                         EINVAL);
-        GF_VALIDATE_OR_GOTO_WITH_ERROR (this->name, loc->parent, out,
-                                        op_errno, EINVAL);
         GF_VALIDATE_OR_GOTO_WITH_ERROR (this->name, loc->name, out, op_errno,
                                         EINVAL);