mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH V2] debugfs: keep the old mode value at remount when no explicit change
@ 2014-08-29  2:33 Chen LinX
  2014-08-29 18:26 ` Greg KH
  0 siblings, 1 reply; 2+ messages in thread
From: Chen LinX @ 2014-08-29  2:33 UTC (permalink / raw)
  To: gregkh, linux-kernel; +Cc: yanmin_zhang, Chen, LinX, He, Bo

From: "Chen, LinX" <linx.z.chen@intel.com>

Android framework has a good method to detect userspace hang and reports
UIWDT issues. It uses client/server model. Clients communicate with
servers by binder. binder has debugfs interfaces. Some files show what
threads are communicating with what other threads. If one thread is
blocked for a long time, we can find the blocking chain from the binder
info. Since the error dumping process has no root access, booting
process changes debugfs mount dir mode to 0755. When UIWDT happens,
the error dumping process can read the info.

Unfortunately, some other scripts at booting try to mount debugfs for
many times. No matter if the double mounting fails or succeeds,
debugfs_parse_options changes the root inode's mode back to default
0700. It means the effect of previous mode changing to 0755 is lost.
At UIWDT, the dumping process can't save binder info to disk log files.

The patch checks if debugfs_mount_opts->mode is initiated. If it is
already, it bypasses the reinitiation, and the old mode value is kept.

Signed-off-by: He, Bo <bo.he@intel.com>
Signed-off-by: Chen, LinX <linx.z.chen@intel.com>
---
 fs/debugfs/inode.c |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/fs/debugfs/inode.c b/fs/debugfs/inode.c
index c7c83ff..f1eb4b9 100644
--- a/fs/debugfs/inode.c
+++ b/fs/debugfs/inode.c
@@ -159,7 +159,8 @@ static int debugfs_parse_options(char *data, struct debugfs_mount_opts *opts)
 	kgid_t gid;
 	char *p;
 
-	opts->mode = DEBUGFS_DEFAULT_MODE;
+	if (opts->mode == 0)
+		opts->mode = DEBUGFS_DEFAULT_MODE;
 
 	while ((p = strsep(&data, ",")) != NULL) {
 		if (!*p)
-- 
1.7.9.5


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2014-08-29 18:26 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-08-29  2:33 [PATCH V2] debugfs: keep the old mode value at remount when no explicit change Chen LinX
2014-08-29 18:26 ` Greg KH

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®