Skip to contentSkip to conversation

JFS: always load filesystem UUID during mount

PATCH Applied João Paredes 2 participants 2 messages Mar 2 – Mar 16 1 message not in the archive JFS filesystem

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

#1 lore raw

PATCH 1/1 JFS: always load filesystem UUID during mount

The filesystem UUID was only being loaded into super_block sb when an external journal device was in use. When mounting without an external journal, the UUID remained unset, which prevented the computation of a filesystem ID (fsid), which could be confirmed via stat -f -c "%i" and thus user space could not use fanotify correctly.

A missing filesystem ID causes fanotify to return ENODEV when marking the filesystem for events like FAN_CREATE, FAN_DELETE, FAN_MOVED_TO, and FAN_MOVED_FROM. As a result, applications relying on fanotify could not monitor these events on JFS filesystems without an external journal.

Moved the UUID initialization so it is always performed during mount, ensuring the superblock UUID is consistently available.

---
 fs/jfs/jfs_mount.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
fs/jfs/jfs_mount.c +2 -1
index 52e6b58c5dbd..dac822f15070 100644
@@ -378,11 +378,12 @@ static int chkSuper(struct super_block *sb)
 	sbi->nbperpage = PSIZE >> sbi->l2bsize;
 	sbi->l2nbperpage = L2PSIZE - sbi->l2bsize;
 	sbi->l2niperblk = sbi->l2bsize - L2DISIZE;
+	uuid_copy(&sbi->uuid, &j_sb->s_uuid);
+
 	if (sbi->mntflag & JFS_INLINELOG)
 		sbi->logpxd = j_sb->s_logpxd;
 	else {
 		sbi->logdev = new_decode_dev(le32_to_cpu(j_sb->s_logdev));
-		uuid_copy(&sbi->uuid, &j_sb->s_uuid);
 		uuid_copy(&sbi->loguuid, &j_sb->s_loguuid);
 	}
 	sbi->fsckpxd = j_sb->s_fsckpxd;
Signature · 1 line
2.53.0
#2 lore raw
Quoted 12 lines · João Paredes

The filesystem UUID was only being loaded into super_block sb when an external journal device was in use. When mounting without an external journal, the UUID remained unset, which prevented the computation of a filesystem ID (fsid), which could be confirmed via stat -f -c "%i" and thus user space could not use fanotify correctly.

A missing filesystem ID causes fanotify to return ENODEV when marking the filesystem for events like FAN_CREATE, FAN_DELETE, FAN_MOVED_TO, and FAN_MOVED_FROM. As a result, applications relying on fanotify could not monitor these events on JFS filesystems without an external journal.

Quoted 4 lines

Moved the UUID initialization so it is always performed during mount, ensuring the superblock UUID is consistently available.

Applied to jfs-next.

Thanks!
Shaggy

Quoted 22 lines
---
  fs/jfs/jfs_mount.c | 3 ++-
  1 file changed, 2 insertions(+), 1 deletion(-)
fs/jfs/jfs_mount.c +2 -1
index 52e6b58c5dbd..dac822f15070 100644
@@ -378,11 +378,12 @@ static int chkSuper(struct super_block *sb)
  	sbi->nbperpage = PSIZE >> sbi->l2bsize;
  	sbi->l2nbperpage = L2PSIZE - sbi->l2bsize;
  	sbi->l2niperblk = sbi->l2bsize - L2DISIZE;
+	uuid_copy(&sbi->uuid, &j_sb->s_uuid);
+
  	if (sbi->mntflag & JFS_INLINELOG)
  		sbi->logpxd = j_sb->s_logpxd;
  	else {
  		sbi->logdev = new_decode_dev(le32_to_cpu(j_sb->s_logdev));
-		uuid_copy(&sbi->uuid, &j_sb->s_uuid);
  		uuid_copy(&sbi->loguuid, &j_sb->s_loguuid);
  	}
  	sbi->fsckpxd = j_sb->s_fsckpxd;