From: Petr Vorel <pvorel@suse.cz>
To: linux-nfs@vger.kernel.org
Cc: Petr Vorel <pvorel@suse.cz>,
"J . Bruce Fields" <bfields@redhat.com>,
Tom Haynes <loghyr@hammerspace.com>,
"Yong Sun (Sero)" <yosun@suse.com>
Subject: [PATCH pynfs 1/2] st_flex: Fix comparison operator, compare int
Date: Fri, 21 May 2021 07:46:32 +0200 [thread overview]
Message-ID: <20210521054633.3170-1-pvorel@suse.cz> (raw)
It fixes Python 3 warning:
nfs4.1/server41tests/st_flex.py:618: SyntaxWarning: "is not" with a literal. Did you mean "!="?
if nfsstat4[res.status] is not 'NFS4_OK':
0bfa03c correctly changed NFS4_OK to string, as nfsstat4 dictionary
values are strings, but comparator was not changed.
But instead of just changing operator to '!=' also use res.status
directly thus we can compare with NFS4_OK (int variable) instead of
"NFS4_OK" (string literal => typos not detected).
Fixes: 0bfa03c ("st_flex: Fixup check for error in layoutget_return()")
Signed-off-by: Petr Vorel <pvorel@suse.cz>
---
nfs4.1/server41tests/st_flex.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/nfs4.1/server41tests/st_flex.py b/nfs4.1/server41tests/st_flex.py
index 169db69..766b213 100644
--- a/nfs4.1/server41tests/st_flex.py
+++ b/nfs4.1/server41tests/st_flex.py
@@ -615,7 +615,7 @@ def layoutget_return(sess, fh, open_stateid, allowed_errors=NFS4_OK,
0, NFS4_MAXFILELEN, 4196, open_stateid, 0xffff)]
res = sess.compound(ops)
check(res, allowed_errors)
- if nfsstat4[res.status] is not 'NFS4_OK':
+ if res.status != NFS4_OK:
return [res] # We can't return the layout without a stateid!
layout_stateid = res.resarray[-1].logr_stateid
--
2.31.1
next reply other threads:[~2021-05-21 5:46 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-05-21 5:46 Petr Vorel [this message]
2021-05-21 5:46 ` [PATCH pynfs 2/2] 4.1 server: Compare with int variable instead of string Petr Vorel
2021-05-21 18:07 ` J. Bruce Fields
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20210521054633.3170-1-pvorel@suse.cz \
--to=pvorel@suse.cz \
--cc=bfields@redhat.com \
--cc=linux-nfs@vger.kernel.org \
--cc=loghyr@hammerspace.com \
--cc=yosun@suse.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.