Patchwork [BUG:2553] nfs: Remove redundant and erroneous check for create mode EXCLUSIVE.

login
register
Submitter Vikas Gorur
Date 2011-03-18 00:38:49
Message ID <1300408729-3248-1-git-send-email-vikas@gluster.com>
Download mbox | patch
Permalink /patch/6507/
State Accepted
Delegated to: Anand Avati
Headers show

Comments

Vikas Gorur - 2011-03-18 00:38:49
nfs3.c/nfs3_create_common:

The if condition checks for create mode being EXCLUSIVE. However, when
create mode is EXCLUSIVE, this function never gets called (nfs3_create_exclusive is
called). Also, instead of checking, it actually sets the value of createmode (= instead of ==).

Signed-off-by: Vikas Gorur <vikas@gluster.com>
---
 xlators/nfs/server/src/nfs3.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
Shehjar Tikoo - 2011-03-18 06:50:48
Why is the check for EXCLUSIVE redundant?

----- Original Message -----
> From: "Vikas Gorur" <vikas@gluster.com>
> To: glusterfs@dev.gluster.com, avati@gluster.com
> Sent: Friday, March 18, 2011 6:08:49 AM
> Subject: [PATCH BUG:2553] nfs: Remove redundant and erroneous check for create mode EXCLUSIVE.
> nfs3.c/nfs3_create_common:
> 
> The if condition checks for create mode being EXCLUSIVE. However, when
> create mode is EXCLUSIVE, this function never gets called
> (nfs3_create_exclusive is
> called). Also, instead of checking, it actually sets the value of
> createmode (= instead of ==).
> 
> Signed-off-by: Vikas Gorur <vikas@gluster.com>
> ---
> xlators/nfs/server/src/nfs3.c | 2 +-
> 1 files changed, 1 insertions(+), 1 deletions(-)
> 
> diff --git a/xlators/nfs/server/src/nfs3.c
> b/xlators/nfs/server/src/nfs3.c
> index e23d4ad..f60a1e6 100644
> --- a/xlators/nfs/server/src/nfs3.c
> +++ b/xlators/nfs/server/src/nfs3.c
> @@ -2361,7 +2361,7 @@ nfs3_create_common (nfs3_call_state_t *cs)
> if (!cs)
> return ret;
> 
> - if ((cs->createmode == UNCHECKED) || (cs->createmode = EXCLUSIVE))
> + if (cs->createmode == UNCHECKED)
> flags = O_RDWR;
> else if (cs->createmode == GUARDED)
> flags = (O_RDWR | O_EXCL);
> --
> 1.5.5.6
> 
> _______________________________________________
> glusterfs mailing list
> glusterfs@dev.gluster.com
> http://dev.gluster.com/cgi-bin/mailman/listinfo/glusterfs
Shehjar Tikoo - 2011-03-21 07:37:48
Not reviewed ok. This needs to be fixed in a different manner. Thanks


Vikas Gorur wrote:
> nfs3.c/nfs3_create_common:
> 
> The if condition checks for create mode being EXCLUSIVE. However, when
> create mode is EXCLUSIVE, this function never gets called (nfs3_create_exclusive is
> called). Also, instead of checking, it actually sets the value of createmode (= instead of ==).
> 
> Signed-off-by: Vikas Gorur <vikas@gluster.com>
> ---
>  xlators/nfs/server/src/nfs3.c |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
> 
> diff --git a/xlators/nfs/server/src/nfs3.c b/xlators/nfs/server/src/nfs3.c
> index e23d4ad..f60a1e6 100644
> --- a/xlators/nfs/server/src/nfs3.c
> +++ b/xlators/nfs/server/src/nfs3.c
> @@ -2361,7 +2361,7 @@ nfs3_create_common (nfs3_call_state_t *cs)
>          if (!cs)
>                  return ret;
>  
> -        if ((cs->createmode == UNCHECKED) || (cs->createmode = EXCLUSIVE))
> +        if (cs->createmode == UNCHECKED)
>                  flags = O_RDWR;
>          else if (cs->createmode == GUARDED)
>                  flags = (O_RDWR | O_EXCL);
Shehjar Tikoo - 2011-03-21 09:29:39
I am sorry. This patch is reviewed OK. But there is still a question on the 
  bug report. Thanks.


Vikas Gorur wrote:
> nfs3.c/nfs3_create_common:
> 
> The if condition checks for create mode being EXCLUSIVE. However, when
> create mode is EXCLUSIVE, this function never gets called (nfs3_create_exclusive is
> called). Also, instead of checking, it actually sets the value of createmode (= instead of ==).
> 
> Signed-off-by: Vikas Gorur <vikas@gluster.com>
> ---
>  xlators/nfs/server/src/nfs3.c |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
> 
> diff --git a/xlators/nfs/server/src/nfs3.c b/xlators/nfs/server/src/nfs3.c
> index e23d4ad..f60a1e6 100644
> --- a/xlators/nfs/server/src/nfs3.c
> +++ b/xlators/nfs/server/src/nfs3.c
> @@ -2361,7 +2361,7 @@ nfs3_create_common (nfs3_call_state_t *cs)
>          if (!cs)
>                  return ret;
>  
> -        if ((cs->createmode == UNCHECKED) || (cs->createmode = EXCLUSIVE))
> +        if (cs->createmode == UNCHECKED)
>                  flags = O_RDWR;
>          else if (cs->createmode == GUARDED)
>                  flags = (O_RDWR | O_EXCL);

Patch

diff --git a/xlators/nfs/server/src/nfs3.c b/xlators/nfs/server/src/nfs3.c
index e23d4ad..f60a1e6 100644
--- a/xlators/nfs/server/src/nfs3.c
+++ b/xlators/nfs/server/src/nfs3.c
@@ -2361,7 +2361,7 @@  nfs3_create_common (nfs3_call_state_t *cs)
         if (!cs)
                 return ret;
 
-        if ((cs->createmode == UNCHECKED) || (cs->createmode = EXCLUSIVE))
+        if (cs->createmode == UNCHECKED)
                 flags = O_RDWR;
         else if (cs->createmode == GUARDED)
                 flags = (O_RDWR | O_EXCL);