diff mbox

[RFC,31/35] Revert "vfs: add d_real_inode() helper"

Message ID 20180412150826.20988-32-mszeredi@redhat.com (mailing list archive)
State New, archived
Headers show

Commit Message

Miklos Szeredi April 12, 2018, 3:08 p.m. UTC
This reverts commit a118084432d642eeccb961c7c8cc61525a941fcb.

No user of d_real_inode() remains, so it can be removed.

Signed-off-by: Miklos Szeredi <mszeredi@redhat.com>
---
 include/linux/dcache.h | 12 ------------
 1 file changed, 12 deletions(-)

Comments

Amir Goldstein April 18, 2018, 8:19 a.m. UTC | #1
On Thu, Apr 12, 2018 at 6:08 PM, Miklos Szeredi <mszeredi@redhat.com> wrote:
> This reverts commit a118084432d642eeccb961c7c8cc61525a941fcb.
>
> No user of d_real_inode() remains, so it can be removed.
>

FYI, there is a new user in v4.17-rc1 added by commit
f0a2aa5a2a40 tracing/uprobe: Add support for overlayfs

Seems like this patch got merged without any CC to overlayfs
mailing list nor maintainer?

Not sure yet if overlayfs-rorw patches would allow reverting this
change.

Thanks,
Amir.
Miklos Szeredi April 18, 2018, 11:42 a.m. UTC | #2
On Wed, Apr 18, 2018 at 10:19 AM, Amir Goldstein <amir73il@gmail.com> wrote:
> On Thu, Apr 12, 2018 at 6:08 PM, Miklos Szeredi <mszeredi@redhat.com> wrote:
>> This reverts commit a118084432d642eeccb961c7c8cc61525a941fcb.
>>
>> No user of d_real_inode() remains, so it can be removed.
>>
>
> FYI, there is a new user in v4.17-rc1 added by commit
> f0a2aa5a2a40 tracing/uprobe: Add support for overlayfs
>
> Seems like this patch got merged without any CC to overlayfs
> mailing list nor maintainer?
>
> Not sure yet if overlayfs-rorw patches would allow reverting this
> change.

Not trivial, because uprobe is looking at i_mapping to get a list of
current memory maps.   We could set i_mapping at overlay inode
initialization time, but we definitely can't *change* i_mapping at
copy up.  Which is bound to result in some weird inconsistencies.  So
likely we'll need to keep d_real_inode() for the time being.

Thanks,
Miklos
Steven Rostedt April 18, 2018, 1:38 p.m. UTC | #3
On Wed, 18 Apr 2018 13:42:03 +0200
Miklos Szeredi <miklos@szeredi.hu> wrote:

> On Wed, Apr 18, 2018 at 10:19 AM, Amir Goldstein <amir73il@gmail.com> wrote:
> > On Thu, Apr 12, 2018 at 6:08 PM, Miklos Szeredi <mszeredi@redhat.com> wrote:  
> >> This reverts commit a118084432d642eeccb961c7c8cc61525a941fcb.
> >>
> >> No user of d_real_inode() remains, so it can be removed.
> >>  
> >
> > FYI, there is a new user in v4.17-rc1 added by commit
> > f0a2aa5a2a40 tracing/uprobe: Add support for overlayfs
> >
> > Seems like this patch got merged without any CC to overlayfs
> > mailing list nor maintainer?

It appeared to be a small change with lots of reviewers. I didn't think
it was something to notify the overlayfs folks with. But perhaps I was
wrong.

> >
> > Not sure yet if overlayfs-rorw patches would allow reverting this
> > change.  
> 
> Not trivial, because uprobe is looking at i_mapping to get a list of
> current memory maps.   We could set i_mapping at overlay inode
> initialization time, but we definitely can't *change* i_mapping at
> copy up.  Which is bound to result in some weird inconsistencies.  So
> likely we'll need to keep d_real_inode() for the time being.

I just received this patch:

 http://lkml.kernel.org/r/20180418062907.3210386-1-songliubraving@fb.com

Which removes this code. Can you review it and I'll take it.

-- Steve
Miklos Szeredi April 18, 2018, 1:49 p.m. UTC | #4
On Wed, Apr 18, 2018 at 3:38 PM, Steven Rostedt <rostedt@goodmis.org> wrote:
> On Wed, 18 Apr 2018 13:42:03 +0200
> Miklos Szeredi <miklos@szeredi.hu> wrote:
>
>> On Wed, Apr 18, 2018 at 10:19 AM, Amir Goldstein <amir73il@gmail.com> wrote:
>> > On Thu, Apr 12, 2018 at 6:08 PM, Miklos Szeredi <mszeredi@redhat.com> wrote:
>> >> This reverts commit a118084432d642eeccb961c7c8cc61525a941fcb.
>> >>
>> >> No user of d_real_inode() remains, so it can be removed.
>> >>
>> >
>> > FYI, there is a new user in v4.17-rc1 added by commit
>> > f0a2aa5a2a40 tracing/uprobe: Add support for overlayfs
>> >
>> > Seems like this patch got merged without any CC to overlayfs
>> > mailing list nor maintainer?
>
> It appeared to be a small change with lots of reviewers. I didn't think
> it was something to notify the overlayfs folks with. But perhaps I was
> wrong.

The patch is correct.  The code surrounding it isn't, though.

>
>> >
>> > Not sure yet if overlayfs-rorw patches would allow reverting this
>> > change.
>>
>> Not trivial, because uprobe is looking at i_mapping to get a list of
>> current memory maps.   We could set i_mapping at overlay inode
>> initialization time, but we definitely can't *change* i_mapping at
>> copy up.  Which is bound to result in some weird inconsistencies.  So
>> likely we'll need to keep d_real_inode() for the time being.
>
> I just received this patch:
>
>  http://lkml.kernel.org/r/20180418062907.3210386-1-songliubraving@fb.com
>
> Which removes this code. Can you review it and I'll take it.

It shouldn't remove d_real_inode(), because that part is correct and
fixes a real bug in handling overlayfs files.

I'll review, but apparently I wasn't CC-d on that patch.   Weird.

Thanks,
Miklos
Steven Rostedt April 18, 2018, 1:56 p.m. UTC | #5
On Wed, 18 Apr 2018 15:49:02 +0200
Miklos Szeredi <miklos@szeredi.hu> wrote:


> > I just received this patch:
> >
> >  http://lkml.kernel.org/r/20180418062907.3210386-1-songliubraving@fb.com
> >
> > Which removes this code. Can you review it and I'll take it.  
> 
> It shouldn't remove d_real_inode(), because that part is correct and
> fixes a real bug in handling overlayfs files.
> 
> I'll review, but apparently I wasn't CC-d on that patch.   Weird.

Especially since you are on the "Reported-by".

My scripts know to add to the Cc "Reported-by" tags. Not all scripts do
though :-/

-- Steve
Vivek Goyal April 19, 2018, 7:54 p.m. UTC | #6
On Wed, Apr 18, 2018 at 03:49:02PM +0200, Miklos Szeredi wrote:
> On Wed, Apr 18, 2018 at 3:38 PM, Steven Rostedt <rostedt@goodmis.org> wrote:
> > On Wed, 18 Apr 2018 13:42:03 +0200
> > Miklos Szeredi <miklos@szeredi.hu> wrote:
> >
> >> On Wed, Apr 18, 2018 at 10:19 AM, Amir Goldstein <amir73il@gmail.com> wrote:
> >> > On Thu, Apr 12, 2018 at 6:08 PM, Miklos Szeredi <mszeredi@redhat.com> wrote:
> >> >> This reverts commit a118084432d642eeccb961c7c8cc61525a941fcb.
> >> >>
> >> >> No user of d_real_inode() remains, so it can be removed.
> >> >>
> >> >
> >> > FYI, there is a new user in v4.17-rc1 added by commit
> >> > f0a2aa5a2a40 tracing/uprobe: Add support for overlayfs
> >> >
> >> > Seems like this patch got merged without any CC to overlayfs
> >> > mailing list nor maintainer?
> >
> > It appeared to be a small change with lots of reviewers. I didn't think
> > it was something to notify the overlayfs folks with. But perhaps I was
> > wrong.
> 
> The patch is correct.  The code surrounding it isn't, though.
> 
> >
> >> >
> >> > Not sure yet if overlayfs-rorw patches would allow reverting this
> >> > change.
> >>
> >> Not trivial, because uprobe is looking at i_mapping to get a list of
> >> current memory maps.   We could set i_mapping at overlay inode
> >> initialization time, but we definitely can't *change* i_mapping at
> >> copy up.  Which is bound to result in some weird inconsistencies.  So
> >> likely we'll need to keep d_real_inode() for the time being.
> >
> > I just received this patch:
> >
> >  http://lkml.kernel.org/r/20180418062907.3210386-1-songliubraving@fb.com
> >
> > Which removes this code. Can you review it and I'll take it.
> 
> It shouldn't remove d_real_inode(), because that part is correct and
> fixes a real bug in handling overlayfs files.

I am wondering what does it practically mean for metdata only copy up
patches. Given this is uprobe code, I am assuming its modifying some
executable code dynamically. And for the the case of metadata only
copy up, it will return inode of lower. That probably means, as long
as all running instances of that exeutable are using that inode, things
will work fine.

But if for some reason somebody opens that file for WRITE and triggers
copy up and new instances of same binary will not see the probe taking
affect?

Which is probably very similar to what will happen if a lower executable
is copied up. Having said that, in normal cases there should not be a
need to copy up a binary in normal circumstances.

Am I missing the point completely.

Thanks
Vivek
Miklos Szeredi April 20, 2018, 9:14 a.m. UTC | #7
On Thu, Apr 19, 2018 at 9:54 PM, Vivek Goyal <vgoyal@redhat.com> wrote:
> On Wed, Apr 18, 2018 at 03:49:02PM +0200, Miklos Szeredi wrote:
>> On Wed, Apr 18, 2018 at 3:38 PM, Steven Rostedt <rostedt@goodmis.org> wrote:
>> > On Wed, 18 Apr 2018 13:42:03 +0200
>> > Miklos Szeredi <miklos@szeredi.hu> wrote:
>> >
>> >> On Wed, Apr 18, 2018 at 10:19 AM, Amir Goldstein <amir73il@gmail.com> wrote:
>> >> > On Thu, Apr 12, 2018 at 6:08 PM, Miklos Szeredi <mszeredi@redhat.com> wrote:
>> >> >> This reverts commit a118084432d642eeccb961c7c8cc61525a941fcb.
>> >> >>
>> >> >> No user of d_real_inode() remains, so it can be removed.
>> >> >>
>> >> >
>> >> > FYI, there is a new user in v4.17-rc1 added by commit
>> >> > f0a2aa5a2a40 tracing/uprobe: Add support for overlayfs
>> >> >
>> >> > Seems like this patch got merged without any CC to overlayfs
>> >> > mailing list nor maintainer?
>> >
>> > It appeared to be a small change with lots of reviewers. I didn't think
>> > it was something to notify the overlayfs folks with. But perhaps I was
>> > wrong.
>>
>> The patch is correct.  The code surrounding it isn't, though.
>>
>> >
>> >> >
>> >> > Not sure yet if overlayfs-rorw patches would allow reverting this
>> >> > change.
>> >>
>> >> Not trivial, because uprobe is looking at i_mapping to get a list of
>> >> current memory maps.   We could set i_mapping at overlay inode
>> >> initialization time, but we definitely can't *change* i_mapping at
>> >> copy up.  Which is bound to result in some weird inconsistencies.  So
>> >> likely we'll need to keep d_real_inode() for the time being.
>> >
>> > I just received this patch:
>> >
>> >  http://lkml.kernel.org/r/20180418062907.3210386-1-songliubraving@fb.com
>> >
>> > Which removes this code. Can you review it and I'll take it.
>>
>> It shouldn't remove d_real_inode(), because that part is correct and
>> fixes a real bug in handling overlayfs files.
>
> I am wondering what does it practically mean for metdata only copy up
> patches. Given this is uprobe code, I am assuming its modifying some
> executable code dynamically. And for the the case of metadata only
> copy up, it will return inode of lower. That probably means, as long
> as all running instances of that exeutable are using that inode, things
> will work fine.
>
> But if for some reason somebody opens that file for WRITE and triggers
> copy up and new instances of same binary will not see the probe taking
> affect?
>
> Which is probably very similar to what will happen if a lower executable
> is copied up. Having said that, in normal cases there should not be a
> need to copy up a binary in normal circumstances.

The only thing we need to ensure when uprobes interact with copy-ups
is that the kernel doesn't crash and doesn't leak memory.  Other than
that, it's a totally uninteresting corner case and we don't need to
worry about its behavior.

Thanks,
Miklos
diff mbox

Patch

diff --git a/include/linux/dcache.h b/include/linux/dcache.h
index c2dea5e78f54..129ef05759a9 100644
--- a/include/linux/dcache.h
+++ b/include/linux/dcache.h
@@ -586,18 +586,6 @@  static inline struct dentry *d_real(struct dentry *dentry,
 		return dentry;
 }
 
-/**
- * d_real_inode - Return the real inode
- * @dentry: The dentry to query
- *
- * If dentry is on a union/overlay, then return the underlying, real inode.
- * Otherwise return d_inode().
- */
-static inline struct inode *d_real_inode(struct dentry *dentry)
-{
-	return d_backing_inode(d_real(dentry, NULL, 0));
-}
-
 struct name_snapshot {
 	const unsigned char *name;
 	unsigned char inline_name[DNAME_INLINE_LEN];