Skip to content

lock: dump filepath name for rwsem waiters#204

Open
richl9 wants to merge 1 commit intooracle-samples:mainfrom
richl9:richard/lock
Open

lock: dump filepath name for rwsem waiters#204
richl9 wants to merge 1 commit intooracle-samples:mainfrom
richl9:richard/lock

Conversation

@richl9
Copy link
Contributor

@richl9 richl9 commented Feb 26, 2026

No description provided.

Orabug: 39017612
Signed-off-by: Richard Li <tianqi.li@oracle.com>
@oracle-contributor-agreement oracle-contributor-agreement bot added the OCA Verified All contributors have signed the Oracle Contributor Agreement. label Feb 26, 2026
Copy link
Member

@brenns10 brenns10 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks good, though you don't need to scan the stack for the nameidata - details below. More importantly, can you share a bit about the motivation for this? Locking and filesystems aren't inherently related, so displaying the filename currently being looked up seems a bit out of place.

I could see it being helpful in some cases for sure, and I'm definitely not opposed to including it to help those cases. Just wanted to hear the background (and maybe include that in the commit message?)

Comment on lines +594 to +596
if filp_frame and "nd" in filp_frame.locals():
nameidata = filp_frame["nd"]
pathname = escape_ascii_string(nameidata.name.name.string_())
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You're in luck -- check the field task_struct.nameidata and the functions set_nameidata() and restore_nameidata() in fs/namei.c. It's a pointer to the nameidata for the currently in-progress filename lookup. You can avoid the stack trace altogether.

I would also note that do_filp_open() has been renamed to do_file_open() since commit torvalds/linux@541003b576c3e ("rename do_filp_open() to do_file_open()"). If you want to only display the in-lookup filename for cases where a file is being opened, then you'll need to check for that name as well.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That sounds nice! Let me look into that.

@brenns10
Copy link
Member

Oh, also please be sure to push this branch to a branch named github/pull-request-204 in the internal Gitlab repo. We need the CI tests to run there too for each merged PR.

@biger410
Copy link
Member

wondering whether we should make a separate kernfs lock contention module, there you can list the process, semaphore status, and kernfs file by using the api provided by lock module, and that will leave lock module for generic lock?

@brenns10
Copy link
Member

Or maybe what we really want is a way for different drgn-tools subsystems to detect and register the locks they care about, so any subsystem can provide context about the lock.

@richl9
Copy link
Contributor Author

richl9 commented Feb 27, 2026

Yeah, either way makes sense to me. We need to refactor the code a bit to make things loosely coupled.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

OCA Verified All contributors have signed the Oracle Contributor Agreement.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants