linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] fs: export vfs_stat() and vfs_fstatat()
@ 2020-11-26  7:15 Yicong Yang
  2020-11-26  7:18 ` Christoph Hellwig
  0 siblings, 1 reply; 7+ messages in thread
From: Yicong Yang @ 2020-11-26  7:15 UTC (permalink / raw)
  To: viro, linux-fsdevel; +Cc: hch, linux-kernel, prime.zeng, linuxarm, yangyicong

The public function vfs_stat() and vfs_fstatat() are
unexported after moving out of line in
commit 09f1bde4017e ("fs: move vfs_fstatat out of line"),
which will prevent the using in kernel modules.
So make them exported.

Fixes: 09f1bde4017e ("fs: move vfs_fstatat out of line")
Reported-by: Yang Shen <shenyang39@huawei.com>
Signed-off-by: Yicong Yang <yangyicong@hisilicon.com>
---
 fs/stat.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/fs/stat.c b/fs/stat.c
index dacecdd..7d690c6 100644
--- a/fs/stat.c
+++ b/fs/stat.c
@@ -147,6 +147,7 @@ int vfs_fstat(int fd, struct kstat *stat)
 	fdput(f);
 	return error;
 }
+EXPORT_SYMBOL(vfs_fstat);

 /**
  * vfs_statx - Get basic and extra attributes by filename
@@ -207,6 +208,7 @@ int vfs_fstatat(int dfd, const char __user *filename,
 	return vfs_statx(dfd, filename, flags | AT_NO_AUTOMOUNT,
 			 stat, STATX_BASIC_STATS);
 }
+EXPORT_SYMBOL(vfs_fstatat);

 #ifdef __ARCH_WANT_OLD_STAT

--
2.8.1


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

* Re: [PATCH] fs: export vfs_stat() and vfs_fstatat()
  2020-11-26  7:15 [PATCH] fs: export vfs_stat() and vfs_fstatat() Yicong Yang
@ 2020-11-26  7:18 ` Christoph Hellwig
  2020-11-26  9:08   ` Yicong Yang
  0 siblings, 1 reply; 7+ messages in thread
From: Christoph Hellwig @ 2020-11-26  7:18 UTC (permalink / raw)
  To: Yicong Yang; +Cc: viro, linux-fsdevel, hch, linux-kernel, prime.zeng, linuxarm

On Thu, Nov 26, 2020 at 03:15:48PM +0800, Yicong Yang wrote:
> The public function vfs_stat() and vfs_fstatat() are
> unexported after moving out of line in
> commit 09f1bde4017e ("fs: move vfs_fstatat out of line"),
> which will prevent the using in kernel modules.
> So make them exported.

And why would you want to use them in kernel module?  Please explain
that in the patch that exports them, and please send that patch in the
same series as the patches adding the users.

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

* Re: [PATCH] fs: export vfs_stat() and vfs_fstatat()
  2020-11-26  7:18 ` Christoph Hellwig
@ 2020-11-26  9:08   ` Yicong Yang
  2020-11-26  9:15     ` Christoph Hellwig
  0 siblings, 1 reply; 7+ messages in thread
From: Yicong Yang @ 2020-11-26  9:08 UTC (permalink / raw)
  To: Christoph Hellwig; +Cc: viro, linux-fsdevel, linux-kernel, prime.zeng, linuxarm

Hi Christoph,

On 2020/11/26 15:18, Christoph Hellwig wrote:
> On Thu, Nov 26, 2020 at 03:15:48PM +0800, Yicong Yang wrote:
>> The public function vfs_stat() and vfs_fstatat() are
>> unexported after moving out of line in
>> commit 09f1bde4017e ("fs: move vfs_fstatat out of line"),
>> which will prevent the using in kernel modules.
>> So make them exported.
> And why would you want to use them in kernel module?  Please explain
> that in the patch that exports them, and please send that patch in the
> same series as the patches adding the users.

we're using it in the modules for testing our crypto driver on our CI system.
is it mandatory to upstream it if we want to use this function?

Thanks,
Yicong


> .
>


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

* Re: [PATCH] fs: export vfs_stat() and vfs_fstatat()
  2020-11-26  9:08   ` Yicong Yang
@ 2020-11-26  9:15     ` Christoph Hellwig
  2020-11-26  9:48       ` Yicong Yang
  0 siblings, 1 reply; 7+ messages in thread
From: Christoph Hellwig @ 2020-11-26  9:15 UTC (permalink / raw)
  To: Yicong Yang
  Cc: Christoph Hellwig, viro, linux-fsdevel, linux-kernel, prime.zeng,
	linuxarm

On Thu, Nov 26, 2020 at 05:08:26PM +0800, Yicong Yang wrote:
> > And why would you want to use them in kernel module?  Please explain
> > that in the patch that exports them, and please send that patch in the
> > same series as the patches adding the users.
> 
> we're using it in the modules for testing our crypto driver on our CI system.
> is it mandatory to upstream it if we want to use this function?

Yes.  And chances are that you do not actaully need these functions
either, but to suggest a better placement I need to actually see the
code.

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

* Re: [PATCH] fs: export vfs_stat() and vfs_fstatat()
  2020-11-26  9:15     ` Christoph Hellwig
@ 2020-11-26  9:48       ` Yicong Yang
  2020-11-26  9:50         ` Christoph Hellwig
  0 siblings, 1 reply; 7+ messages in thread
From: Yicong Yang @ 2020-11-26  9:48 UTC (permalink / raw)
  To: Christoph Hellwig; +Cc: viro, linux-fsdevel, linux-kernel, prime.zeng, linuxarm

On 2020/11/26 17:15, Christoph Hellwig wrote:
> On Thu, Nov 26, 2020 at 05:08:26PM +0800, Yicong Yang wrote:
>>> And why would you want to use them in kernel module?  Please explain
>>> that in the patch that exports them, and please send that patch in the
>>> same series as the patches adding the users.
>> we're using it in the modules for testing our crypto driver on our CI system.
>> is it mandatory to upstream it if we want to use this function?
> Yes.  And chances are that you do not actaully need these functions
> either, but to suggest a better placement I need to actually see the
> code.
> .

Sorry for not describing the issues I met correctly in the commit message.
Actually we're using inline function vfs_stat() for getting the
attributes, which calls vfs_fstatat():

static inline int vfs_stat(const char __user *filename, struct kstat *stat)
{
	return vfs_fstatat(AT_FDCWD, filename, stat, 0);
}

after the vfs_fstatat is out-of-line it will make the moduler user of vfs_stat()
broken:

[ 5328.903677] crypto_zip_perf_test: Unknown symbol vfs_fstatat (err -2)

so the simplest way i think is directly export the vfs_fstatat().

Thanks,
Yicong




>


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

* Re: [PATCH] fs: export vfs_stat() and vfs_fstatat()
  2020-11-26  9:48       ` Yicong Yang
@ 2020-11-26  9:50         ` Christoph Hellwig
  2020-11-26 10:44           ` Yicong Yang
  0 siblings, 1 reply; 7+ messages in thread
From: Christoph Hellwig @ 2020-11-26  9:50 UTC (permalink / raw)
  To: Yicong Yang
  Cc: Christoph Hellwig, viro, linux-fsdevel, linux-kernel, prime.zeng,
	linuxarm

On Thu, Nov 26, 2020 at 05:48:25PM +0800, Yicong Yang wrote:
> Sorry for not describing the issues I met correctly in the commit message.
> Actually we're using inline function vfs_stat() for getting the
> attributes, which calls vfs_fstatat():

Again, there generally isn't much need to look at the stat data
for an in-kernel caller.  But without you submitting the code I can't
really help you anyway.

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

* Re: [PATCH] fs: export vfs_stat() and vfs_fstatat()
  2020-11-26  9:50         ` Christoph Hellwig
@ 2020-11-26 10:44           ` Yicong Yang
  0 siblings, 0 replies; 7+ messages in thread
From: Yicong Yang @ 2020-11-26 10:44 UTC (permalink / raw)
  To: Christoph Hellwig; +Cc: viro, linux-fsdevel, linux-kernel, prime.zeng, linuxarm

On 2020/11/26 17:50, Christoph Hellwig wrote:
> On Thu, Nov 26, 2020 at 05:48:25PM +0800, Yicong Yang wrote:
>> Sorry for not describing the issues I met correctly in the commit message.
>> Actually we're using inline function vfs_stat() for getting the
>> attributes, which calls vfs_fstatat():
> Again, there generally isn't much need to look at the stat data
> for an in-kernel caller.  But without you submitting the code I can't
> really help you anyway.
> .

sure. we'll check to see whether it's necessary or there is other way. 

many thanks!




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

end of thread, other threads:[~2020-11-26 10:45 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-11-26  7:15 [PATCH] fs: export vfs_stat() and vfs_fstatat() Yicong Yang
2020-11-26  7:18 ` Christoph Hellwig
2020-11-26  9:08   ` Yicong Yang
2020-11-26  9:15     ` Christoph Hellwig
2020-11-26  9:48       ` Yicong Yang
2020-11-26  9:50         ` Christoph Hellwig
2020-11-26 10:44           ` Yicong Yang

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).