Skip to contentSkip to conversation

Add process name to locks warning

PATCH Applied Andi Kleen 2 participants 4 messages Nov 19, 2022

Subsystems (2)
lore
Share & tools
lore

Andi Kleen

author
#0 lore raw

PATCH 1/1 Add process name to locks warning

It's fairly useless to complain about using an obsolete feature without telling the user which process used it. My Fedora desktop randomly drops this message, but I would really need this patch to figure out what triggers is.

---
 fs/locks.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
fs/locks.c +1 -1
index 607f94a0e789..2e45232dbeb1 100644
@@ -2096,7 +2096,7 @@ SYSCALL_DEFINE2(flock, unsigned int, fd, unsigned int, cmd)
 	 * throw a warning to let people know that they don't actually work.
 	 */
 	if (cmd & LOCK_MAND) {
-		pr_warn_once("Attempt to set a LOCK_MAND lock via flock(2). This support has been removed and the request ignored.\n");
+		pr_warn_once("%s: Attempt to set a LOCK_MAND lock via flock(2). This support has been removed and the request ignored.\n", current->comm);
 		return 0;
 	}
 
Signature · 1 line
2.37.3
maintainer
#1 lore raw
Quoted 5 lines · Andi Kleen

It's fairly useless to complain about using an obsolete feature without telling the user which process used it. My Fedora desktop randomly drops this message, but I would really need this patch to figure out what triggers is.

Interesting. The only program I know of that tried to use these was samba, but we patched that out a few years ago (about the time this patch went in). Are you running an older version of samba?

Quoted 10 lines
---
 fs/locks.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
fs/locks.c +0 -0
index 607f94a0e789..2e45232dbeb1 100644

fs/locks.c SYSCALL_DEFINE2(flock, unsigned int, fd, unsigned int, cmd) · line 2102

Quoted 8 lines
fs/locks.c +1 -1
@@ -2096,7 +2096,7 @@ SYSCALL_DEFINE2(flock, unsigned int, fd, unsigned int, cmd)
 	 * throw a warning to let people know that they don't actually work.
 	 */
 	if (cmd & LOCK_MAND) {
-		pr_warn_once("Attempt to set a LOCK_MAND lock via flock(2). This support has been removed and the request ignored.\n");
+		pr_warn_once("%s: Attempt to set a LOCK_MAND lock via flock(2). This support has been removed and the request ignored.\n", current->comm);
 		return 0;
 	}
 

Looks reasonable. Would it help to print the pid or tgid as well?

Signature · 1 line
Jeff Layton <[email protected]>
maintainer Applied
#2 lore raw
Quoted 16 lines · Jeff Layton
Quoted 5 lines · Andi Kleen

It's fairly useless to complain about using an obsolete feature without telling the user which process used it. My Fedora desktop randomly drops this message, but I would really need this patch to figure out what triggers is.

Interesting. The only program I know of that tried to use these was samba, but we patched that out a few years ago (about the time this patch went in). Are you running an older version of samba?

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

fs/locks.c SYSCALL_DEFINE2(flock, unsigned int, fd, unsigned int, cmd) · line 2102

Quoted 13 lines
fs/locks.c +1 -1
index 607f94a0e789..2e45232dbeb1 100644
@@ -2096,7 +2096,7 @@ SYSCALL_DEFINE2(flock, unsigned int, fd, unsigned int, cmd)
 	 * throw a warning to let people know that they don't actually work.
 	 */
 	if (cmd & LOCK_MAND) {
-		pr_warn_once("Attempt to set a LOCK_MAND lock via flock(2). This support has been removed and the request ignored.\n");
+		pr_warn_once("%s: Attempt to set a LOCK_MAND lock via flock(2). This support has been removed and the request ignored.\n", current->comm);
 		return 0;
 	}
 

Looks reasonable. Would it help to print the pid or tgid as well?

Merged into my locks-next branch, along with a small change to print current->pid in addition to current->comm. This should make v6.2.

Thanks!

Signature · 1 line
Jeff Layton <[email protected]>
author
#3 lore raw
In reply to Jeff Layton
Quoted 9 lines · Jeff Layton
Quoted 5 lines · Andi Kleen

It's fairly useless to complain about using an obsolete feature without telling the user which process used it. My Fedora desktop randomly drops this message, but I would really need this patch to figure out what triggers is.

Interesting. The only program I know of that tried to use these was samba, but we patched that out a few years ago (about the time this patch went in). Are you running an older version of samba?

Yes it's running samba, whatever is in Fedora 35. Don't know if that counts as an

older version.

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

fs/locks.c SYSCALL_DEFINE2(flock, unsigned int, fd, unsigned int, cmd) · line 2102

Quoted 13 lines
fs/locks.c +1 -1
index 607f94a0e789..2e45232dbeb1 100644
@@ -2096,7 +2096,7 @@ SYSCALL_DEFINE2(flock, unsigned int, fd, unsigned int, cmd)
  	 * throw a warning to let people know that they don't actually work.
  	 */
  	if (cmd & LOCK_MAND) {
-		pr_warn_once("Attempt to set a LOCK_MAND lock via flock(2). This support has been removed and the request ignored.\n");
+		pr_warn_once("%s: Attempt to set a LOCK_MAND lock via flock(2). This support has been removed and the request ignored.\n", current->comm);
  		return 0;
  	}
 

Looks reasonable. Would it help to print the pid or tgid as well?

It wouldn't help me because at that time I see it it's likely long gone. Just need the name.