Skip to contentSkip to conversation

locks: print unsigned ino in /proc/locks

PATCH In review Amir Goldstein 2 participants 4 messages Dec 22, 2019 – Dec 29, 2019

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 locks: print unsigned ino in /proc/locks

An ino is unsigned so export it as such in /proc/locks.

---

Hi Jeff,

Ran into this while writing tests to verify i_ino == d_ino == st_ino on overlayfs. In some configurations (xino=on) overlayfs sets MSB on i_ino, so /proc/locks reports negative ino values.

BTW, the requirement for (i_ino == d_ino) came from nfsd v3 readdirplus.

Thanks,
Amir.

 fs/locks.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
fs/locks.c +1 -1
index 6970f55daf54..44b6da032842 100644
@@ -2853,7 +2853,7 @@ static void lock_get_status(struct seq_file *f, struct file_lock *fl,
 	}
 	if (inode) {
 		/* userspace relies on this representation of dev_t */
-		seq_printf(f, "%d %02x:%02x:%ld ", fl_pid,
+		seq_printf(f, "%d %02x:%02x:%lu ", fl_pid,
 				MAJOR(inode->i_sb->s_dev),
 				MINOR(inode->i_sb->s_dev), inode->i_ino);
 	} else {
Signature · 1 line
2.17.1
maintainer
#1 lore raw
Quoted 24 lines · Amir Goldstein

An ino is unsigned so export it as such in /proc/locks.

---

Hi Jeff,

Ran into this while writing tests to verify i_ino == d_ino == st_ino on overlayfs. In some configurations (xino=on) overlayfs sets MSB on i_ino, so /proc/locks reports negative ino values.

BTW, the requirement for (i_ino == d_ino) came from nfsd v3 readdirplus.

Thanks,
Amir.

 fs/locks.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
fs/locks.c +0 -0
index 6970f55daf54..44b6da032842 100644

fs/locks.c static void lock_get_status(struct seq_file *f, struct file_lock *fl, · line 2859

Quoted 8 lines
fs/locks.c +1 -1
@@ -2853,7 +2853,7 @@ static void lock_get_status(struct seq_file *f, struct file_lock *fl,
 	}
 	if (inode) {
 		/* userspace relies on this representation of dev_t */
-		seq_printf(f, "%d %02x:%02x:%ld ", fl_pid,
+		seq_printf(f, "%d %02x:%02x:%lu ", fl_pid,
 				MAJOR(inode->i_sb->s_dev),
 				MINOR(inode->i_sb->s_dev), inode->i_ino);
 	} else {

My that is an old bug! I think that goes back to early v2.x days, if not v1.x. I'll queue it up, and maybe we can get this in for v5.6.

Thanks!

Signature · 1 line
Jeff Layton <[email protected]>
#2 lore raw
Quoted 21 lines · Jeff Layton
Quoted 19 lines · Amir Goldstein

An ino is unsigned so export it as such in /proc/locks.

---

Hi Jeff,

Ran into this while writing tests to verify i_ino == d_ino == st_ino on overlayfs. In some configurations (xino=on) overlayfs sets MSB on i_ino, so /proc/locks reports negative ino values.

BTW, the requirement for (i_ino == d_ino) came from nfsd v3 readdirplus.

Thanks,
Amir.

 fs/locks.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
Quoted 16 lines

fs/locks.c static void lock_get_status(struct seq_file *f, struct file_lock *fl, · line 2859

Quoted 13 lines
fs/locks.c +1 -1
index 6970f55daf54..44b6da032842 100644
@@ -2853,7 +2853,7 @@ static void lock_get_status(struct seq_file *f, struct file_lock *fl,
      }
      if (inode) {
              /* userspace relies on this representation of dev_t */
-             seq_printf(f, "%d %02x:%02x:%ld ", fl_pid,
+             seq_printf(f, "%d %02x:%02x:%lu ", fl_pid,
                              MAJOR(inode->i_sb->s_dev),
                              MINOR(inode->i_sb->s_dev), inode->i_ino);
      } else {

My that is an old bug! I think that goes back to early v2.x days, if not v1.x. I'll queue it up, and maybe we can get this in for v5.6.

I suppose you meant for v5.5?
I'd be happy if we can also mark it for stable (sorry I did not). Reason is that I have xfstests depending on it, which test overlay fixes that are marked for stable.

Thanks,
Amir.

maintainer
#3 lore raw
Quoted 38 lines · Amir Goldstein
Quoted 20 lines · Jeff Layton
Quoted 19 lines · Amir Goldstein

An ino is unsigned so export it as such in /proc/locks.

---

Hi Jeff,

Ran into this while writing tests to verify i_ino == d_ino == st_ino on overlayfs. In some configurations (xino=on) overlayfs sets MSB on i_ino, so /proc/locks reports negative ino values.

BTW, the requirement for (i_ino == d_ino) came from nfsd v3 readdirplus.

Thanks,
Amir.

 fs/locks.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
Quoted 16 lines

fs/locks.c static void lock_get_status(struct seq_file *f, struct file_lock *fl, · line 2859

Quoted 13 lines
fs/locks.c +1 -1
index 6970f55daf54..44b6da032842 100644
@@ -2853,7 +2853,7 @@ static void lock_get_status(struct seq_file *f, struct file_lock *fl,
      }
      if (inode) {
              /* userspace relies on this representation of dev_t */
-             seq_printf(f, "%d %02x:%02x:%ld ", fl_pid,
+             seq_printf(f, "%d %02x:%02x:%lu ", fl_pid,
                              MAJOR(inode->i_sb->s_dev),
                              MINOR(inode->i_sb->s_dev), inode->i_ino);
      } else {

My that is an old bug! I think that goes back to early v2.x days, if not v1.x. I'll queue it up, and maybe we can get this in for v5.6.

Quoted 5 lines

I suppose you meant for v5.5?
I'd be happy if we can also mark it for stable (sorry I did not). Reason is that I have xfstests depending on it, which test overlay fixes that are marked for stable.

Oh! I didn't realize the urgency. It's been in -next for a week or so now, so I think it's probably safe enough. I'll send a PR soon, after I give it a bit more testing.

Thanks!

Signature · 1 line
Jeff Layton <[email protected]>