linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] devtmpfs: Calling delete_path() only when necessary
@ 2013-11-16  8:15 Axel Lin
  2013-12-04  2:59 ` Rob Landley
  0 siblings, 1 reply; 11+ messages in thread
From: Axel Lin @ 2013-11-16  8:15 UTC (permalink / raw)
  To: Greg Kroah-Hartman, Al Viro; +Cc: Kay Sievers, linux-kernel

The deleted variable is always 1 in current code.
Initialize deleted variable to be 0, so delete_path() will be called only when
necessary.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
---
 drivers/base/devtmpfs.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/base/devtmpfs.c b/drivers/base/devtmpfs.c
index 0f38201..25798db 100644
--- a/drivers/base/devtmpfs.c
+++ b/drivers/base/devtmpfs.c
@@ -299,7 +299,7 @@ static int handle_remove(const char *nodename, struct device *dev)
 {
 	struct path parent;
 	struct dentry *dentry;
-	int deleted = 1;
+	int deleted = 0;
 	int err;
 
 	dentry = kern_path_locked(nodename, &parent);
-- 
1.8.1.2




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

* Re: [PATCH] devtmpfs: Calling delete_path() only when necessary
  2013-11-16  8:15 [PATCH] devtmpfs: Calling delete_path() only when necessary Axel Lin
@ 2013-12-04  2:59 ` Rob Landley
  2013-12-04  6:44   ` Axel Lin
  0 siblings, 1 reply; 11+ messages in thread
From: Rob Landley @ 2013-12-04  2:59 UTC (permalink / raw)
  To: Axel Lin; +Cc: Greg Kroah-Hartman, Al Viro, Kay Sievers, linux-kernel

On 11/16/2013 02:15:23 AM, Axel Lin wrote:
> The deleted variable is always 1 in current code.
> Initialize deleted variable to be 0, so delete_path() will be called  
> only when
> necessary.
> 
> Signed-off-by: Axel Lin <axel.lin@ingics.com>

I'm not seeing this in linux-next, or a reply on the web archive.  
Assuming nobody's objected to this, you might want to forward it to  
trivial@kernel.org.

That said, you could describe what it _does_ a little more?

Thanks,

Rob

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

* Re: [PATCH] devtmpfs: Calling delete_path() only when necessary
  2013-12-04  2:59 ` Rob Landley
@ 2013-12-04  6:44   ` Axel Lin
  2013-12-04  7:10     ` Greg Kroah-Hartman
  2013-12-09  6:46     ` Greg Kroah-Hartman
  0 siblings, 2 replies; 11+ messages in thread
From: Axel Lin @ 2013-12-04  6:44 UTC (permalink / raw)
  To: Rob Landley; +Cc: Greg Kroah-Hartman, Al Viro, Kay Sievers, linux-kernel

2013/12/4 Rob Landley <rob@landley.net>:
> On 11/16/2013 02:15:23 AM, Axel Lin wrote:
>>
>> The deleted variable is always 1 in current code.
>> Initialize deleted variable to be 0, so delete_path() will be called only
>> when
>> necessary.
>>
>> Signed-off-by: Axel Lin <axel.lin@ingics.com>
>
>
> I'm not seeing this in linux-next, or a reply on the web archive. Assuming
> nobody's objected to this, you might want to forward it to
> trivial@kernel.org.
>
> That said, you could describe what it _does_ a little more?

I was expecting Greg to pick up this patch.

I thought the description is pretty clear.
What the patch does is changing the init value of deleted variable to 0.
The intention of this change is to avoid unnecessary delete_path() call.

Hi Greg,
Would you pick up this patch?
If a re-send or a v2 is required, please just let me know.

Thanks,
Axel

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

* Re: [PATCH] devtmpfs: Calling delete_path() only when necessary
  2013-12-04  6:44   ` Axel Lin
@ 2013-12-04  7:10     ` Greg Kroah-Hartman
  2013-12-09  6:46     ` Greg Kroah-Hartman
  1 sibling, 0 replies; 11+ messages in thread
From: Greg Kroah-Hartman @ 2013-12-04  7:10 UTC (permalink / raw)
  To: Axel Lin; +Cc: Rob Landley, Al Viro, Kay Sievers, linux-kernel

On Wed, Dec 04, 2013 at 02:44:14PM +0800, Axel Lin wrote:
> 2013/12/4 Rob Landley <rob@landley.net>:
> > On 11/16/2013 02:15:23 AM, Axel Lin wrote:
> >>
> >> The deleted variable is always 1 in current code.
> >> Initialize deleted variable to be 0, so delete_path() will be called only
> >> when
> >> necessary.
> >>
> >> Signed-off-by: Axel Lin <axel.lin@ingics.com>
> >
> >
> > I'm not seeing this in linux-next, or a reply on the web archive. Assuming
> > nobody's objected to this, you might want to forward it to
> > trivial@kernel.org.
> >
> > That said, you could describe what it _does_ a little more?
> 
> I was expecting Greg to pick up this patch.
> 
> I thought the description is pretty clear.
> What the patch does is changing the init value of deleted variable to 0.
> The intention of this change is to avoid unnecessary delete_path() call.
> 
> Hi Greg,
> Would you pick up this patch?
> If a re-send or a v2 is required, please just let me know.

It's in my queue to get to, sorry, it's huge and slowly going down, it's
not lost...

greg k-h

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

* Re: [PATCH] devtmpfs: Calling delete_path() only when necessary
  2013-12-04  6:44   ` Axel Lin
  2013-12-04  7:10     ` Greg Kroah-Hartman
@ 2013-12-09  6:46     ` Greg Kroah-Hartman
  2013-12-09  8:54       ` Axel Lin
  1 sibling, 1 reply; 11+ messages in thread
From: Greg Kroah-Hartman @ 2013-12-09  6:46 UTC (permalink / raw)
  To: Axel Lin; +Cc: Rob Landley, Al Viro, Kay Sievers, linux-kernel

On Wed, Dec 04, 2013 at 02:44:14PM +0800, Axel Lin wrote:
> 2013/12/4 Rob Landley <rob@landley.net>:
> > On 11/16/2013 02:15:23 AM, Axel Lin wrote:
> >>
> >> The deleted variable is always 1 in current code.
> >> Initialize deleted variable to be 0, so delete_path() will be called only
> >> when
> >> necessary.
> >>
> >> Signed-off-by: Axel Lin <axel.lin@ingics.com>
> >
> >
> > I'm not seeing this in linux-next, or a reply on the web archive. Assuming
> > nobody's objected to this, you might want to forward it to
> > trivial@kernel.org.
> >
> > That said, you could describe what it _does_ a little more?
> 
> I was expecting Greg to pick up this patch.
> 
> I thought the description is pretty clear.
> What the patch does is changing the init value of deleted variable to 0.
> The intention of this change is to avoid unnecessary delete_path() call.

I agree the logic is a bit odd here, but are you seeing an "unnecessary"
delete_path() call happening?  The code has always been like this from
what I can tell...

thanks,

greg k-h

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

* Re: [PATCH] devtmpfs: Calling delete_path() only when necessary
  2013-12-09  6:46     ` Greg Kroah-Hartman
@ 2013-12-09  8:54       ` Axel Lin
  2013-12-09  9:05         ` Greg Kroah-Hartman
  0 siblings, 1 reply; 11+ messages in thread
From: Axel Lin @ 2013-12-09  8:54 UTC (permalink / raw)
  To: Greg Kroah-Hartman; +Cc: Rob Landley, Al Viro, Kay Sievers, linux-kernel

2013/12/9 Greg Kroah-Hartman <gregkh@linuxfoundation.org>:
> On Wed, Dec 04, 2013 at 02:44:14PM +0800, Axel Lin wrote:
>> 2013/12/4 Rob Landley <rob@landley.net>:
>> > On 11/16/2013 02:15:23 AM, Axel Lin wrote:
>> >>
>> >> The deleted variable is always 1 in current code.
>> >> Initialize deleted variable to be 0, so delete_path() will be called only
>> >> when
>> >> necessary.
>> >>
>> >> Signed-off-by: Axel Lin <axel.lin@ingics.com>
>> >
>> >
>> > I'm not seeing this in linux-next, or a reply on the web archive. Assuming
>> > nobody's objected to this, you might want to forward it to
>> > trivial@kernel.org.
>> >
>> > That said, you could describe what it _does_ a little more?
>>
>> I was expecting Greg to pick up this patch.
>>
>> I thought the description is pretty clear.
>> What the patch does is changing the init value of deleted variable to 0.
>> The intention of this change is to avoid unnecessary delete_path() call.
>
> I agree the logic is a bit odd here, but are you seeing an "unnecessary"
> delete_path() call happening?  The code has always been like this from
> what I can tell...

Honestly, I havn't see the "unnecessary" delete_path() call happening druing my
test. I look at the code when I was debugging a hangup issue.
(In the end, I think the issue is not related to the devtmpfs code.)
But I found the logic for the deleted variable looks odd.
There are below possible (unlikely) case:
When strchr(nodename, '/') != 0 and
1. If dentry->d_inode is NULL
2. vfs_getattr returns error
3. vfs_unlink returns error except -ENOENT.

In these cases, delete_path() will fail anyway.

Although this is a unlikely case, and I know the code is there since initial
commit. But I think it's still good to fix it.

Regards,
Axel

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

* Re: [PATCH] devtmpfs: Calling delete_path() only when necessary
  2013-12-09  8:54       ` Axel Lin
@ 2013-12-09  9:05         ` Greg Kroah-Hartman
  2013-12-09  9:06           ` Axel Lin
  0 siblings, 1 reply; 11+ messages in thread
From: Greg Kroah-Hartman @ 2013-12-09  9:05 UTC (permalink / raw)
  To: Axel Lin; +Cc: Rob Landley, Al Viro, Kay Sievers, linux-kernel

On Mon, Dec 09, 2013 at 04:54:29PM +0800, Axel Lin wrote:
> 2013/12/9 Greg Kroah-Hartman <gregkh@linuxfoundation.org>:
> > On Wed, Dec 04, 2013 at 02:44:14PM +0800, Axel Lin wrote:
> >> 2013/12/4 Rob Landley <rob@landley.net>:
> >> > On 11/16/2013 02:15:23 AM, Axel Lin wrote:
> >> >>
> >> >> The deleted variable is always 1 in current code.
> >> >> Initialize deleted variable to be 0, so delete_path() will be called only
> >> >> when
> >> >> necessary.
> >> >>
> >> >> Signed-off-by: Axel Lin <axel.lin@ingics.com>
> >> >
> >> >
> >> > I'm not seeing this in linux-next, or a reply on the web archive. Assuming
> >> > nobody's objected to this, you might want to forward it to
> >> > trivial@kernel.org.
> >> >
> >> > That said, you could describe what it _does_ a little more?
> >>
> >> I was expecting Greg to pick up this patch.
> >>
> >> I thought the description is pretty clear.
> >> What the patch does is changing the init value of deleted variable to 0.
> >> The intention of this change is to avoid unnecessary delete_path() call.
> >
> > I agree the logic is a bit odd here, but are you seeing an "unnecessary"
> > delete_path() call happening?  The code has always been like this from
> > what I can tell...
> 
> Honestly, I havn't see the "unnecessary" delete_path() call happening druing my
> test. I look at the code when I was debugging a hangup issue.
> (In the end, I think the issue is not related to the devtmpfs code.)
> But I found the logic for the deleted variable looks odd.
> There are below possible (unlikely) case:
> When strchr(nodename, '/') != 0 and
> 1. If dentry->d_inode is NULL
> 2. vfs_getattr returns error
> 3. vfs_unlink returns error except -ENOENT.
> 
> In these cases, delete_path() will fail anyway.
> 
> Although this is a unlikely case, and I know the code is there since initial
> commit. But I think it's still good to fix it.

Have you tested your patch to verify nothing breaks?

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

* Re: [PATCH] devtmpfs: Calling delete_path() only when necessary
  2013-12-09  9:05         ` Greg Kroah-Hartman
@ 2013-12-09  9:06           ` Axel Lin
  2013-12-10  6:08             ` Axel Lin
  0 siblings, 1 reply; 11+ messages in thread
From: Axel Lin @ 2013-12-09  9:06 UTC (permalink / raw)
  To: Greg Kroah-Hartman; +Cc: Rob Landley, Al Viro, Kay Sievers, linux-kernel

2013/12/9 Greg Kroah-Hartman <gregkh@linuxfoundation.org>:
> On Mon, Dec 09, 2013 at 04:54:29PM +0800, Axel Lin wrote:
>> 2013/12/9 Greg Kroah-Hartman <gregkh@linuxfoundation.org>:
>> > On Wed, Dec 04, 2013 at 02:44:14PM +0800, Axel Lin wrote:
>> >> 2013/12/4 Rob Landley <rob@landley.net>:
>> >> > On 11/16/2013 02:15:23 AM, Axel Lin wrote:
>> >> >>
>> >> >> The deleted variable is always 1 in current code.
>> >> >> Initialize deleted variable to be 0, so delete_path() will be called only
>> >> >> when
>> >> >> necessary.
>> >> >>
>> >> >> Signed-off-by: Axel Lin <axel.lin@ingics.com>
>> >> >
>> >> >
>> >> > I'm not seeing this in linux-next, or a reply on the web archive. Assuming
>> >> > nobody's objected to this, you might want to forward it to
>> >> > trivial@kernel.org.
>> >> >
>> >> > That said, you could describe what it _does_ a little more?
>> >>
>> >> I was expecting Greg to pick up this patch.
>> >>
>> >> I thought the description is pretty clear.
>> >> What the patch does is changing the init value of deleted variable to 0.
>> >> The intention of this change is to avoid unnecessary delete_path() call.
>> >
>> > I agree the logic is a bit odd here, but are you seeing an "unnecessary"
>> > delete_path() call happening?  The code has always been like this from
>> > what I can tell...
>>
>> Honestly, I havn't see the "unnecessary" delete_path() call happening druing my
>> test. I look at the code when I was debugging a hangup issue.
>> (In the end, I think the issue is not related to the devtmpfs code.)
>> But I found the logic for the deleted variable looks odd.
>> There are below possible (unlikely) case:
>> When strchr(nodename, '/') != 0 and
>> 1. If dentry->d_inode is NULL
>> 2. vfs_getattr returns error
>> 3. vfs_unlink returns error except -ENOENT.
>>
>> In these cases, delete_path() will fail anyway.
>>
>> Although this is a unlikely case, and I know the code is there since initial
>> commit. But I think it's still good to fix it.
>
> Have you tested your patch to verify nothing breaks?
Yes. I have this patch in my local build image since the day I sent the patch.
Regards,
Axel

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

* Re: [PATCH] devtmpfs: Calling delete_path() only when necessary
  2013-12-09  9:06           ` Axel Lin
@ 2013-12-10  6:08             ` Axel Lin
  2013-12-10  7:26               ` Fengguang Wu
  0 siblings, 1 reply; 11+ messages in thread
From: Axel Lin @ 2013-12-10  6:08 UTC (permalink / raw)
  To: Greg Kroah-Hartman, Wu Fengguang
  Cc: Rob Landley, Al Viro, Kay Sievers, linux-kernel

2013/12/9 Axel Lin <axel.lin@ingics.com>:
> 2013/12/9 Greg Kroah-Hartman <gregkh@linuxfoundation.org>:
>> On Mon, Dec 09, 2013 at 04:54:29PM +0800, Axel Lin wrote:
>>> 2013/12/9 Greg Kroah-Hartman <gregkh@linuxfoundation.org>:
>>> > On Wed, Dec 04, 2013 at 02:44:14PM +0800, Axel Lin wrote:
>>> >> 2013/12/4 Rob Landley <rob@landley.net>:
>>> >> > On 11/16/2013 02:15:23 AM, Axel Lin wrote:
>>> >> >>
>>> >> >> The deleted variable is always 1 in current code.
>>> >> >> Initialize deleted variable to be 0, so delete_path() will be called only
>>> >> >> when
>>> >> >> necessary.
>>> >> >>
>>> >> >> Signed-off-by: Axel Lin <axel.lin@ingics.com>
>>> >> >
>>> >> >
>>> >> > I'm not seeing this in linux-next, or a reply on the web archive. Assuming
>>> >> > nobody's objected to this, you might want to forward it to
>>> >> > trivial@kernel.org.
>>> >> >
>>> >> > That said, you could describe what it _does_ a little more?
>>> >>
>>> >> I was expecting Greg to pick up this patch.
>>> >>
>>> >> I thought the description is pretty clear.
>>> >> What the patch does is changing the init value of deleted variable to 0.
>>> >> The intention of this change is to avoid unnecessary delete_path() call.
>>> >
>>> > I agree the logic is a bit odd here, but are you seeing an "unnecessary"
>>> > delete_path() call happening?  The code has always been like this from
>>> > what I can tell...
>>>
>>> Honestly, I havn't see the "unnecessary" delete_path() call happening druing my
>>> test. I look at the code when I was debugging a hangup issue.
>>> (In the end, I think the issue is not related to the devtmpfs code.)
>>> But I found the logic for the deleted variable looks odd.
>>> There are below possible (unlikely) case:
>>> When strchr(nodename, '/') != 0 and
>>> 1. If dentry->d_inode is NULL
>>> 2. vfs_getattr returns error
>>> 3. vfs_unlink returns error except -ENOENT.
>>>
>>> In these cases, delete_path() will fail anyway.
>>>
>>> Although this is a unlikely case, and I know the code is there since initial
>>> commit. But I think it's still good to fix it.
>>
>> Have you tested your patch to verify nothing breaks?
> Yes. I have this patch in my local build image since the day I sent the patch.
Hi Greg,
If you want more testing for this patch to ensure nothing break,
I think maybe Fengguang can also help to test it.

Hi, Fengguang
Can you help to add this patch to your test systems?
It's a one-line change, you can find the patch at
https://patchwork.kernel.org/patch/3192361/

Regards,
Axel

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

* Re: [PATCH] devtmpfs: Calling delete_path() only when necessary
  2013-12-10  6:08             ` Axel Lin
@ 2013-12-10  7:26               ` Fengguang Wu
  2013-12-10  7:53                 ` Greg Kroah-Hartman
  0 siblings, 1 reply; 11+ messages in thread
From: Fengguang Wu @ 2013-12-10  7:26 UTC (permalink / raw)
  To: Axel Lin
  Cc: Greg Kroah-Hartman, Rob Landley, Al Viro, Kay Sievers, linux-kernel

> Hi, Fengguang
> Can you help to add this patch to your test systems?
> It's a one-line change, you can find the patch at
> https://patchwork.kernel.org/patch/3192361/

Hi Axel,

Do you have a public git tree? If not, I'd like to take this chance to
encourage you to setup one. The best work flow is to create a branch,
apply the patch and tell me the git URL and branch name to test.

Thanks,
Fengguang

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

* Re: [PATCH] devtmpfs: Calling delete_path() only when necessary
  2013-12-10  7:26               ` Fengguang Wu
@ 2013-12-10  7:53                 ` Greg Kroah-Hartman
  0 siblings, 0 replies; 11+ messages in thread
From: Greg Kroah-Hartman @ 2013-12-10  7:53 UTC (permalink / raw)
  To: Fengguang Wu; +Cc: Axel Lin, Rob Landley, Al Viro, Kay Sievers, linux-kernel

On Tue, Dec 10, 2013 at 03:26:33PM +0800, Fengguang Wu wrote:
> > Hi, Fengguang
> > Can you help to add this patch to your test systems?
> > It's a one-line change, you can find the patch at
> > https://patchwork.kernel.org/patch/3192361/
> 
> Hi Axel,
> 
> Do you have a public git tree? If not, I'd like to take this chance to
> encourage you to setup one. The best work flow is to create a branch,
> apply the patch and tell me the git URL and branch name to test.

Unless you have a bunch of devices added and removed from the system
dynamically, you really aren't going to hit this codepath, so I don't
think your automated system really is going to help out much here,
sorry.

greg k-h

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

end of thread, other threads:[~2013-12-10  7:51 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-11-16  8:15 [PATCH] devtmpfs: Calling delete_path() only when necessary Axel Lin
2013-12-04  2:59 ` Rob Landley
2013-12-04  6:44   ` Axel Lin
2013-12-04  7:10     ` Greg Kroah-Hartman
2013-12-09  6:46     ` Greg Kroah-Hartman
2013-12-09  8:54       ` Axel Lin
2013-12-09  9:05         ` Greg Kroah-Hartman
2013-12-09  9:06           ` Axel Lin
2013-12-10  6:08             ` Axel Lin
2013-12-10  7:26               ` Fengguang Wu
2013-12-10  7:53                 ` Greg Kroah-Hartman

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).