OCFS2-Devel Archive on lore.kernel.org
 help / color / 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
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 index

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

OCFS2-Devel Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/ocfs2-devel/0 ocfs2-devel/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 ocfs2-devel ocfs2-devel/ https://lore.kernel.org/ocfs2-devel \
		ocfs2-devel@oss.oracle.com
	public-inbox-index ocfs2-devel

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/com.oracle.oss.ocfs2-devel


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git