ocfs2-devel.oss.oracle.com archive mirror
 help / color / mirror / Atom feed
From: Junxiao Bi <junxiao.bi@oracle.com>
To: ocfs2-devel@oss.oracle.com
Subject: [Ocfs2-devel] [PATCH 4/4] ocfs2: fix value of OCFS2_INVALID_SLOT
Date: Tue, 16 Jun 2020 11:38:29 -0700	[thread overview]
Message-ID: <20200616183829.87211-5-junxiao.bi@oracle.com> (raw)
In-Reply-To: <20200616183829.87211-1-junxiao.bi@oracle.com>

From ocfs2 disk layout, slot number is 16 bits, but in ocfs2 implemtation,
slot number is 32 bits, usually this will not cause any issue, because
slot number is converting from u16 to u32, but OCFS2_INVALID_SLOT was
defined as -1, when an invalid slot number from disk was got, it value
was (u16)-1, and it was converted to u32, then the following checking
in get_local_system_inode will be always skipped.

 static struct inode **get_local_system_inode(struct ocfs2_super *osb,
                                               int type,
                                               u32 slot)
 {
 	BUG_ON(slot == OCFS2_INVALID_SLOT);
	...
 }

Signed-off-by: Junxiao Bi <junxiao.bi@oracle.com>
---
 fs/ocfs2/ocfs2_fs.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/ocfs2/ocfs2_fs.h b/fs/ocfs2/ocfs2_fs.h
index 3fc99659ed09..19137c6d087b 100644
--- a/fs/ocfs2/ocfs2_fs.h
+++ b/fs/ocfs2/ocfs2_fs.h
@@ -290,7 +290,7 @@
 #define OCFS2_MAX_SLOTS			255
 
 /* Slot map indicator for an empty slot */
-#define OCFS2_INVALID_SLOT		-1
+#define OCFS2_INVALID_SLOT		((u16)-1)
 
 #define OCFS2_VOL_UUID_LEN		16
 #define OCFS2_MAX_VOL_LABEL_LEN		64
-- 
2.20.1 (Apple Git-117)

  parent reply	other threads:[~2020-06-16 18:38 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-06-16 18:38 [Ocfs2-devel] [v2] ocfs2: fix nfsd over ocfs2 issues Junxiao Bi
2020-06-16 18:38 ` [Ocfs2-devel] [PATCH 1/4] ocfs2: avoid inode removed while nfsd access it Junxiao Bi
2020-06-17  3:01   ` Joseph Qi
2020-06-17 20:57     ` Andrew Morton
2020-06-17 22:56       ` Junxiao Bi
2020-06-16 18:38 ` [Ocfs2-devel] [PATCH 2/4] ocfs2: load global_inode_alloc Junxiao Bi
2020-06-17  3:03   ` Joseph Qi
2020-06-16 18:38 ` [Ocfs2-devel] [PATCH 3/4] ocfs2: fix panic on nfs server over ocfs2 Junxiao Bi
2020-06-17  3:10   ` Joseph Qi
2020-06-16 18:38 ` Junxiao Bi [this message]
2020-06-17  3:26   ` [Ocfs2-devel] [PATCH 4/4] ocfs2: fix value of OCFS2_INVALID_SLOT Joseph Qi
2020-07-02  8:48   ` Gang He
2020-07-02 14:13     ` Joseph Qi
2020-07-02 17:51       ` Junxiao Bi
2020-07-03  3:41       ` Gang He
2020-07-03  8:41         ` Gang He
2020-07-03 12:03           ` Joseph Qi
2020-07-03 13:12             ` Gang He

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=20200616183829.87211-5-junxiao.bi@oracle.com \
    --to=junxiao.bi@oracle.com \
    --cc=ocfs2-devel@oss.oracle.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).