public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] debugfs: keep the old valid mode value when no explicity specify it
@ 2014-08-28 10:09 Chen LinX
  2014-08-28 15:10 ` Greg KH
  0 siblings, 1 reply; 4+ messages in thread
From: Chen LinX @ 2014-08-28 10:09 UTC (permalink / raw)
  To: gregkh, linux-kernel; +Cc: yanmin_zhang, Chen, LinX, He, Bo

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

When mount debugfs with no mode specifed after it's mounted, the mount
point mode will change to default mode(0700) even the mount operation was fail,
this will cause some issues like can't get binder info in android. Here we can
keep the old valid mode if no explicity specify the mode value and also change
the mode value even the mount fails if the mode value is specified.

Change-Id: I591ce5328e9589adfc3d7317f04276bf0033202a
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 related	[flat|nested] 4+ messages in thread

* Re: [PATCH] debugfs: keep the old valid mode value when no explicity specify it
  2014-08-28 10:09 [PATCH] debugfs: keep the old valid mode value when no explicity specify it Chen LinX
@ 2014-08-28 15:10 ` Greg KH
  2014-08-29  1:30   ` Zhang, Yanmin
  0 siblings, 1 reply; 4+ messages in thread
From: Greg KH @ 2014-08-28 15:10 UTC (permalink / raw)
  To: Chen LinX; +Cc: linux-kernel, yanmin_zhang, He, Bo

On Thu, Aug 28, 2014 at 06:09:09PM +0800, Chen LinX wrote:
> From: "Chen, LinX" <linx.z.chen@intel.com>
> 
> When mount debugfs with no mode specifed after it's mounted, the mount
> point mode will change to default mode(0700) even the mount operation was fail,
> this will cause some issues like can't get binder info in android.

I don't understand, what did you do to get into this state?

And why does binder care about debugfs?

> Here we can keep the old valid mode if no explicity specify the mode
> value and also change the mode value even the mount fails if the mode
> value is specified.

I can't parse this sentence :(

> Change-Id: I591ce5328e9589adfc3d7317f04276bf0033202a

Please never put these markings in patches for inclusion in the upstream
kernel, as they make no sense.

thanks,

greg k-h

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

* Re: [PATCH] debugfs: keep the old valid mode value when no explicity specify it
  2014-08-28 15:10 ` Greg KH
@ 2014-08-29  1:30   ` Zhang, Yanmin
  2014-08-29 18:24     ` Greg KH
  0 siblings, 1 reply; 4+ messages in thread
From: Zhang, Yanmin @ 2014-08-29  1:30 UTC (permalink / raw)
  To: Greg KH, Chen LinX; +Cc: linux-kernel, He, Bo

On 2014/8/28 23:10, Greg KH wrote:

> On Thu, Aug 28, 2014 at 06:09:09PM +0800, Chen LinX wrote:
>> From: "Chen, LinX" <linx.z.chen@intel.com>
>>
>> When mount debugfs with no mode specifed after it's mounted, the mount
>> point mode will change to default mode(0700) even the mount operation was fail,
>> this will cause some issues like can't get binder info in android.
> I don't understand, what did you do to get into this state?

Greg,

Thanks for your kind quick comments. The patch description can be improved.

We hit the issue when debugging a UIWDT issue. Android framework has a good
method to detect userspace hang and reports UIWDT issues. Android uses
client/server model. Clients communicates 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 the 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.

>
> And why does binder care about debugfs?
>
>> Here we can keep the old valid mode if no explicity specify the mode
>> value and also change the mode value even the mount fails if the mode
>> value is specified.
> I can't parse this sentence :(

Lin's patch checks if debugfs_mount_opts->mode is initiated.
If it is already, the patch would bypass the reinitiation, so the old mode
value is kept.

Yanmin


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

* Re: [PATCH] debugfs: keep the old valid mode value when no explicity specify it
  2014-08-29  1:30   ` Zhang, Yanmin
@ 2014-08-29 18:24     ` Greg KH
  0 siblings, 0 replies; 4+ messages in thread
From: Greg KH @ 2014-08-29 18:24 UTC (permalink / raw)
  To: Zhang, Yanmin; +Cc: Chen LinX, linux-kernel, He, Bo

On Fri, Aug 29, 2014 at 09:30:54AM +0800, Zhang, Yanmin wrote:
> On 2014/8/28 23:10, Greg KH wrote:
> 
> >On Thu, Aug 28, 2014 at 06:09:09PM +0800, Chen LinX wrote:
> >>From: "Chen, LinX" <linx.z.chen@intel.com>
> >>
> >>When mount debugfs with no mode specifed after it's mounted, the mount
> >>point mode will change to default mode(0700) even the mount operation was fail,
> >>this will cause some issues like can't get binder info in android.
> >I don't understand, what did you do to get into this state?
> 
> Greg,
> 
> Thanks for your kind quick comments. The patch description can be improved.
> 
> We hit the issue when debugging a UIWDT issue. Android framework has a good
> method to detect userspace hang and reports UIWDT issues. Android uses
> client/server model. Clients communicates 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 the 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.

Then fix those other scripts, don't try to work around broken userspace
scripts by changing the kernel.

Sorry, I can't take this patch.

greg k-h

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

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

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-08-28 10:09 [PATCH] debugfs: keep the old valid mode value when no explicity specify it Chen LinX
2014-08-28 15:10 ` Greg KH
2014-08-29  1:30   ` Zhang, Yanmin
2014-08-29 18:24     ` Greg KH

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