diff mbox

nfsd: Remove write permission from file content

Message ID 1357299935-9321-1-git-send-email-ycnian@gmail.com (mailing list archive)
State New, archived
Headers show

Commit Message

ycnian@gmail.com Jan. 4, 2013, 11:45 a.m. UTC
From: Yanchuan Nian <ycnian@gmail.com>

The write function doesn't be implemented in file content, and it's meaningless
to write data into this file directly. Remove write permission from it.

Signed-off-by: Yanchuan Nian <ycnian@gmail.com>
---
 net/sunrpc/cache.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

Comments

J. Bruce Fields Jan. 4, 2013, 9:12 p.m. UTC | #1
On Fri, Jan 04, 2013 at 07:45:35PM +0800, ycnian@gmail.com wrote:
> From: Yanchuan Nian <ycnian@gmail.com>
> 
> The write function doesn't be implemented in file content, and it's meaningless
> to write data into this file directly. Remove write permission from it.

So does it really matter either way?

OK, applying, but I wonder.

--b.

> 
> Signed-off-by: Yanchuan Nian <ycnian@gmail.com>
> ---
>  net/sunrpc/cache.c |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
> 
> diff --git a/net/sunrpc/cache.c b/net/sunrpc/cache.c
> index 9afa439..9f84703 100644
> --- a/net/sunrpc/cache.c
> +++ b/net/sunrpc/cache.c
> @@ -1614,7 +1614,7 @@ static int create_cache_proc_entries(struct cache_detail *cd, struct net *net)
>  			goto out_nomem;
>  	}
>  	if (cd->cache_show) {
> -		p = proc_create_data("content", S_IFREG|S_IRUSR|S_IWUSR,
> +		p = proc_create_data("content", S_IFREG|S_IRUSR,
>  				cd->u.procfs.proc_ent,
>  				&content_file_operations_procfs, cd);
>  		cd->u.procfs.content_ent = p;
> -- 
> 1.7.4.4
> 
--
To unsubscribe from this list: send the line "unsubscribe linux-nfs" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
J. Bruce Fields Jan. 8, 2013, 3:18 p.m. UTC | #2
On Sat, Jan 05, 2013 at 12:29:05PM +0800, Yanchuan Nian wrote:
> 2013/1/5 J. Bruce Fields <bfields@fieldses.org>
> 
> > On Fri, Jan 04, 2013 at 07:45:35PM +0800, ycnian@gmail.com wrote:
> > > From: Yanchuan Nian <ycnian@gmail.com>
> > >
> > > The write function doesn't be implemented in file content, and it's
> > meaningless
> > > to write data into this file directly. Remove write permission from it.
> >
> > So does it really matter either way?
> >
> No, it doesn't matter. I saw that nfs-utils communicates with nfsd through
> proc fs, so I tried to update the cache by writing data to proc fs
> directly. I found the format of "channel" and "flush" in nfs-utils, but I
> couldn't find the format of "content", so I read the sunrpc source code,
> and found that the write function doesn't be implemented, but the write
> permission is set when registering into proc fs. I also found that
> "content" in pipe fs doesn't have write permission.

OK, so if it had been read-only it might have saved you a little
confusion.  Fair enough.

--b.

> 
> >
> > OK, applying, but I wonder.
> >
> > --b.
> >
> > >
> > > Signed-off-by: Yanchuan Nian <ycnian@gmail.com>
> > > ---
> > >  net/sunrpc/cache.c |    2 +-
> > >  1 files changed, 1 insertions(+), 1 deletions(-)
> > >
> > > diff --git a/net/sunrpc/cache.c b/net/sunrpc/cache.c
> > > index 9afa439..9f84703 100644
> > > --- a/net/sunrpc/cache.c
> > > +++ b/net/sunrpc/cache.c
> > > @@ -1614,7 +1614,7 @@ static int create_cache_proc_entries(struct
> > cache_detail *cd, struct net *net)
> > >                       goto out_nomem;
> > >       }
> > >       if (cd->cache_show) {
> > > -             p = proc_create_data("content", S_IFREG|S_IRUSR|S_IWUSR,
> > > +             p = proc_create_data("content", S_IFREG|S_IRUSR,
> > >                               cd->u.procfs.proc_ent,
> > >                               &content_file_operations_procfs, cd);
> > >               cd->u.procfs.content_ent = p;
> > > --
> > > 1.7.4.4
> > >
> >
--
To unsubscribe from this list: send the line "unsubscribe linux-nfs" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/net/sunrpc/cache.c b/net/sunrpc/cache.c
index 9afa439..9f84703 100644
--- a/net/sunrpc/cache.c
+++ b/net/sunrpc/cache.c
@@ -1614,7 +1614,7 @@  static int create_cache_proc_entries(struct cache_detail *cd, struct net *net)
 			goto out_nomem;
 	}
 	if (cd->cache_show) {
-		p = proc_create_data("content", S_IFREG|S_IRUSR|S_IWUSR,
+		p = proc_create_data("content", S_IFREG|S_IRUSR,
 				cd->u.procfs.proc_ent,
 				&content_file_operations_procfs, cd);
 		cd->u.procfs.content_ent = p;