* Re: LTP ustat01 test fails on NFSROOT
2007-10-25 17:59 ` Trond Myklebust
@ 2007-10-25 18:36 ` Kumar Gala
2007-10-25 18:39 ` Trond Myklebust
2007-10-26 9:42 ` Kumar Gala
2007-11-02 14:28 ` Kumar Gala
2 siblings, 1 reply; 12+ messages in thread
From: Kumar Gala @ 2007-10-25 18:36 UTC (permalink / raw)
To: Trond Myklebust
Cc: Linux Kernel Mailing List, nfs, neilb, bfields, chuck.lever
On Oct 25, 2007, at 12:59 PM, Trond Myklebust wrote:
> Could you please try the following patch?
this fixes my issue. Any reason this hasn't been accepted?
- k
> --------------------------------- CUT HERE
> -----------------------------
> From: Trond Myklebust <Trond.Myklebust@netapp.com>
> Date: Thu, 25 Oct 2007 13:56:10 -0400
> NFS: Fix the ustat() regression
>
> Since 2.6.18, the superblock sb->s_root has been a dummy dentry with a
> dummy inode. This breaks ustat(), which actually uses sb->s_root in a
> vfstat() call.
>
> Fix this by making the s_root a dummy alias to the directory inode
> that was
> used when creating the superblock.
>
> Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
> ---
>
> fs/nfs/getroot.c | 81 +++++++++++++++++
> +------------------------------------
> 1 files changed, 27 insertions(+), 54 deletions(-)
>
> diff --git a/fs/nfs/getroot.c b/fs/nfs/getroot.c
> index 522e5ad..0ee4384 100644
> --- a/fs/nfs/getroot.c
> +++ b/fs/nfs/getroot.c
> @@ -43,6 +43,25 @@
> #define NFSDBG_FACILITY NFSDBG_CLIENT
>
> /*
> + * Set the superblock root dentry.
> + * Note that this function frees the inode in case of error.
> + */
> +static int nfs_superblock_set_dummy_root(struct super_block *sb,
> struct inode *inode)
> +{
> + /* The mntroot acts as the dummy root dentry for this superblock */
> + if (sb->s_root == NULL) {
> + sb->s_root = d_alloc_root(inode);
> + if (sb->s_root == NULL) {
> + iput(inode);
> + return -ENOMEM;
> + }
> + /* Circumvent igrab(): we know the inode is not being freed */
> + atomic_inc(&inode->i_count);
> + }
> + return 0;
> +}
> +
> +/*
> * get an NFS2/NFS3 root dentry from the root filehandle
> */
> struct dentry *nfs_get_root(struct super_block *sb, struct nfs_fh
> *mntfh)
> @@ -54,33 +73,6 @@ struct dentry *nfs_get_root(struct super_block
> *sb, struct nfs_fh *mntfh)
> struct inode *inode;
> int error;
>
> - /* create a dummy root dentry with dummy inode for this
> superblock */
> - if (!sb->s_root) {
> - struct nfs_fh dummyfh;
> - struct dentry *root;
> - struct inode *iroot;
> -
> - memset(&dummyfh, 0, sizeof(dummyfh));
> - memset(&fattr, 0, sizeof(fattr));
> - nfs_fattr_init(&fattr);
> - fattr.valid = NFS_ATTR_FATTR;
> - fattr.type = NFDIR;
> - fattr.mode = S_IFDIR | S_IRUSR | S_IWUSR;
> - fattr.nlink = 2;
> -
> - iroot = nfs_fhget(sb, &dummyfh, &fattr);
> - if (IS_ERR(iroot))
> - return ERR_PTR(PTR_ERR(iroot));
> -
> - root = d_alloc_root(iroot);
> - if (!root) {
> - iput(iroot);
> - return ERR_PTR(-ENOMEM);
> - }
> -
> - sb->s_root = root;
> - }
> -
> /* get the actual root for this mount */
> fsinfo.fattr = &fattr;
>
> @@ -96,6 +88,10 @@ struct dentry *nfs_get_root(struct super_block
> *sb, struct nfs_fh *mntfh)
> return ERR_PTR(PTR_ERR(inode));
> }
>
> + error = nfs_superblock_set_dummy_root(sb, inode);
> + if (error != 0)
> + return ERR_PTR(error);
> +
> /* root dentries normally start off anonymous and get spliced in
> later
> * if the dentry tree reaches them; however if the dentry already
> * exists, we'll pick it up at this point and use it as the root
> @@ -241,33 +237,6 @@ struct dentry *nfs4_get_root(struct
> super_block *sb, struct nfs_fh *mntfh)
>
> dprintk("--> nfs4_get_root()\n");
>
> - /* create a dummy root dentry with dummy inode for this
> superblock */
> - if (!sb->s_root) {
> - struct nfs_fh dummyfh;
> - struct dentry *root;
> - struct inode *iroot;
> -
> - memset(&dummyfh, 0, sizeof(dummyfh));
> - memset(&fattr, 0, sizeof(fattr));
> - nfs_fattr_init(&fattr);
> - fattr.valid = NFS_ATTR_FATTR;
> - fattr.type = NFDIR;
> - fattr.mode = S_IFDIR | S_IRUSR | S_IWUSR;
> - fattr.nlink = 2;
> -
> - iroot = nfs_fhget(sb, &dummyfh, &fattr);
> - if (IS_ERR(iroot))
> - return ERR_PTR(PTR_ERR(iroot));
> -
> - root = d_alloc_root(iroot);
> - if (!root) {
> - iput(iroot);
> - return ERR_PTR(-ENOMEM);
> - }
> -
> - sb->s_root = root;
> - }
> -
> /* get the info about the server and filesystem */
> error = nfs4_server_capabilities(server, mntfh);
> if (error < 0) {
> @@ -289,6 +258,10 @@ struct dentry *nfs4_get_root(struct
> super_block *sb, struct nfs_fh *mntfh)
> return ERR_PTR(PTR_ERR(inode));
> }
>
> + error = nfs_superblock_set_dummy_root(sb, inode);
> + if (error != 0)
> + return ERR_PTR(error);
> +
> /* root dentries normally start off anonymous and get spliced in
> later
> * if the dentry tree reaches them; however if the dentry already
> * exists, we'll pick it up at this point and use it as the root
^ permalink raw reply [flat|nested] 12+ messages in thread* Re: LTP ustat01 test fails on NFSROOT
2007-10-25 18:36 ` Kumar Gala
@ 2007-10-25 18:39 ` Trond Myklebust
2007-10-25 19:05 ` Kumar Gala
0 siblings, 1 reply; 12+ messages in thread
From: Trond Myklebust @ 2007-10-25 18:39 UTC (permalink / raw)
To: Kumar Gala; +Cc: Linux Kernel Mailing List, nfs, neilb, bfields, chuck.lever
On Thu, 2007-10-25 at 13:36 -0500, Kumar Gala wrote:
> On Oct 25, 2007, at 12:59 PM, Trond Myklebust wrote:
>
> > Could you please try the following patch?
>
> this fixes my issue. Any reason this hasn't been accepted?
Do you mean apart from the fact that I wrote it a couple of hours
ago? :-)
Trond
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: LTP ustat01 test fails on NFSROOT
2007-10-25 18:39 ` Trond Myklebust
@ 2007-10-25 19:05 ` Kumar Gala
0 siblings, 0 replies; 12+ messages in thread
From: Kumar Gala @ 2007-10-25 19:05 UTC (permalink / raw)
To: Trond Myklebust
Cc: Linux Kernel Mailing List, nfs, neilb, bfields, chuck.lever
On Oct 25, 2007, at 1:39 PM, Trond Myklebust wrote:
>
> On Thu, 2007-10-25 at 13:36 -0500, Kumar Gala wrote:
>> On Oct 25, 2007, at 12:59 PM, Trond Myklebust wrote:
>>
>>> Could you please try the following patch?
>>
>> this fixes my issue. Any reason this hasn't been accepted?
>
> Do you mean apart from the fact that I wrote it a couple of hours
> ago? :-)
Oh, sorry. I glanced at the commit message and the 2.6.18 made me
think its been around for a while.
- k
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: LTP ustat01 test fails on NFSROOT
2007-10-25 17:59 ` Trond Myklebust
2007-10-25 18:36 ` Kumar Gala
@ 2007-10-26 9:42 ` Kumar Gala
2007-10-29 14:41 ` Kumar Gala
2007-11-02 14:28 ` Kumar Gala
2 siblings, 1 reply; 12+ messages in thread
From: Kumar Gala @ 2007-10-26 9:42 UTC (permalink / raw)
To: Trond Myklebust
Cc: Linux Kernel Mailing List, nfs, neilb, bfields, chuck.lever
On Oct 25, 2007, at 12:59 PM, Trond Myklebust wrote:
> Could you please try the following patch?
>
> Cheers
> Trond
> --------------------------------- CUT HERE
> -----------------------------
> From: Trond Myklebust <Trond.Myklebust@netapp.com>
> Date: Thu, 25 Oct 2007 13:56:10 -0400
> NFS: Fix the ustat() regression
>
> Since 2.6.18, the superblock sb->s_root has been a dummy dentry with a
> dummy inode. This breaks ustat(), which actually uses sb->s_root in a
> vfstat() call.
>
> Fix this by making the s_root a dummy alias to the directory inode
> that was
> used when creating the superblock.
>
> Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
> ---
>
> fs/nfs/getroot.c | 81 +++++++++++++++++
> +------------------------------------
> 1 files changed, 27 insertions(+), 54 deletions(-)
Any reason not to send this to Linus as a bug fix for 2.6.24 (and
possibly stable)?
- k
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: LTP ustat01 test fails on NFSROOT
2007-10-26 9:42 ` Kumar Gala
@ 2007-10-29 14:41 ` Kumar Gala
0 siblings, 0 replies; 12+ messages in thread
From: Kumar Gala @ 2007-10-29 14:41 UTC (permalink / raw)
To: Trond Myklebust
Cc: Linux Kernel Mailing List, nfs, neilb, bfields, chuck.lever
On Oct 26, 2007, at 4:42 AM, Kumar Gala wrote:
>
> On Oct 25, 2007, at 12:59 PM, Trond Myklebust wrote:
>
>> Could you please try the following patch?
>>
>> Cheers
>> Trond
>> --------------------------------- CUT HERE
>> -----------------------------
>> From: Trond Myklebust <Trond.Myklebust@netapp.com>
>> Date: Thu, 25 Oct 2007 13:56:10 -0400
>> NFS: Fix the ustat() regression
>>
>> Since 2.6.18, the superblock sb->s_root has been a dummy dentry
>> with a
>> dummy inode. This breaks ustat(), which actually uses sb->s_root in a
>> vfstat() call.
>>
>> Fix this by making the s_root a dummy alias to the directory inode
>> that was
>> used when creating the superblock.
>>
>> Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
>> ---
>>
>> fs/nfs/getroot.c | 81 +++++++++++++++++
>> +------------------------------------
>> 1 files changed, 27 insertions(+), 54 deletions(-)
>
> Any reason not to send this to Linus as a bug fix for 2.6.24 (and
> possibly stable)?
ping. would love to see this is Linus's tree.
- k
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: LTP ustat01 test fails on NFSROOT
2007-10-25 17:59 ` Trond Myklebust
2007-10-25 18:36 ` Kumar Gala
2007-10-26 9:42 ` Kumar Gala
@ 2007-11-02 14:28 ` Kumar Gala
2007-11-08 7:36 ` Kumar Gala
2 siblings, 1 reply; 12+ messages in thread
From: Kumar Gala @ 2007-11-02 14:28 UTC (permalink / raw)
To: Trond Myklebust
Cc: Linux Kernel Mailing List, nfs, neilb, bfields, chuck.lever,
Andrew Morton
On Thu, 25 Oct 2007, Trond Myklebust wrote:
> Could you please try the following patch?
>
> Cheers
> Trond
Its a new month so I'll ping again about sending this fix upstream to
linus for 2.6.24 :) ?
- k
> --------------------------------- CUT HERE -----------------------------
> From: Trond Myklebust <Trond.Myklebust@netapp.com>
> Date: Thu, 25 Oct 2007 13:56:10 -0400
> NFS: Fix the ustat() regression
>
> Since 2.6.18, the superblock sb->s_root has been a dummy dentry with a
> dummy inode. This breaks ustat(), which actually uses sb->s_root in a
> vfstat() call.
>
> Fix this by making the s_root a dummy alias to the directory inode that was
> used when creating the superblock.
>
> Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
> ---
>
> fs/nfs/getroot.c | 81 ++++++++++++++++++------------------------------------
> 1 files changed, 27 insertions(+), 54 deletions(-)
>
> diff --git a/fs/nfs/getroot.c b/fs/nfs/getroot.c
> index 522e5ad..0ee4384 100644
> --- a/fs/nfs/getroot.c
> +++ b/fs/nfs/getroot.c
> @@ -43,6 +43,25 @@
> #define NFSDBG_FACILITY NFSDBG_CLIENT
>
> /*
> + * Set the superblock root dentry.
> + * Note that this function frees the inode in case of error.
> + */
> +static int nfs_superblock_set_dummy_root(struct super_block *sb, struct inode *inode)
> +{
> + /* The mntroot acts as the dummy root dentry for this superblock */
> + if (sb->s_root == NULL) {
> + sb->s_root = d_alloc_root(inode);
> + if (sb->s_root == NULL) {
> + iput(inode);
> + return -ENOMEM;
> + }
> + /* Circumvent igrab(): we know the inode is not being freed */
> + atomic_inc(&inode->i_count);
> + }
> + return 0;
> +}
> +
> +/*
> * get an NFS2/NFS3 root dentry from the root filehandle
> */
> struct dentry *nfs_get_root(struct super_block *sb, struct nfs_fh *mntfh)
> @@ -54,33 +73,6 @@ struct dentry *nfs_get_root(struct super_block *sb, struct nfs_fh *mntfh)
> struct inode *inode;
> int error;
>
> - /* create a dummy root dentry with dummy inode for this superblock */
> - if (!sb->s_root) {
> - struct nfs_fh dummyfh;
> - struct dentry *root;
> - struct inode *iroot;
> -
> - memset(&dummyfh, 0, sizeof(dummyfh));
> - memset(&fattr, 0, sizeof(fattr));
> - nfs_fattr_init(&fattr);
> - fattr.valid = NFS_ATTR_FATTR;
> - fattr.type = NFDIR;
> - fattr.mode = S_IFDIR | S_IRUSR | S_IWUSR;
> - fattr.nlink = 2;
> -
> - iroot = nfs_fhget(sb, &dummyfh, &fattr);
> - if (IS_ERR(iroot))
> - return ERR_PTR(PTR_ERR(iroot));
> -
> - root = d_alloc_root(iroot);
> - if (!root) {
> - iput(iroot);
> - return ERR_PTR(-ENOMEM);
> - }
> -
> - sb->s_root = root;
> - }
> -
> /* get the actual root for this mount */
> fsinfo.fattr = &fattr;
>
> @@ -96,6 +88,10 @@ struct dentry *nfs_get_root(struct super_block *sb, struct nfs_fh *mntfh)
> return ERR_PTR(PTR_ERR(inode));
> }
>
> + error = nfs_superblock_set_dummy_root(sb, inode);
> + if (error != 0)
> + return ERR_PTR(error);
> +
> /* root dentries normally start off anonymous and get spliced in later
> * if the dentry tree reaches them; however if the dentry already
> * exists, we'll pick it up at this point and use it as the root
> @@ -241,33 +237,6 @@ struct dentry *nfs4_get_root(struct super_block *sb, struct nfs_fh *mntfh)
>
> dprintk("--> nfs4_get_root()\n");
>
> - /* create a dummy root dentry with dummy inode for this superblock */
> - if (!sb->s_root) {
> - struct nfs_fh dummyfh;
> - struct dentry *root;
> - struct inode *iroot;
> -
> - memset(&dummyfh, 0, sizeof(dummyfh));
> - memset(&fattr, 0, sizeof(fattr));
> - nfs_fattr_init(&fattr);
> - fattr.valid = NFS_ATTR_FATTR;
> - fattr.type = NFDIR;
> - fattr.mode = S_IFDIR | S_IRUSR | S_IWUSR;
> - fattr.nlink = 2;
> -
> - iroot = nfs_fhget(sb, &dummyfh, &fattr);
> - if (IS_ERR(iroot))
> - return ERR_PTR(PTR_ERR(iroot));
> -
> - root = d_alloc_root(iroot);
> - if (!root) {
> - iput(iroot);
> - return ERR_PTR(-ENOMEM);
> - }
> -
> - sb->s_root = root;
> - }
> -
> /* get the info about the server and filesystem */
> error = nfs4_server_capabilities(server, mntfh);
> if (error < 0) {
> @@ -289,6 +258,10 @@ struct dentry *nfs4_get_root(struct super_block *sb, struct nfs_fh *mntfh)
> return ERR_PTR(PTR_ERR(inode));
> }
>
> + error = nfs_superblock_set_dummy_root(sb, inode);
> + if (error != 0)
> + return ERR_PTR(error);
> +
> /* root dentries normally start off anonymous and get spliced in later
> * if the dentry tree reaches them; however if the dentry already
> * exists, we'll pick it up at this point and use it as the root
>
^ permalink raw reply [flat|nested] 12+ messages in thread* Re: LTP ustat01 test fails on NFSROOT
2007-11-02 14:28 ` Kumar Gala
@ 2007-11-08 7:36 ` Kumar Gala
0 siblings, 0 replies; 12+ messages in thread
From: Kumar Gala @ 2007-11-08 7:36 UTC (permalink / raw)
To: Trond Myklebust
Cc: Linux Kernel Mailing List, nfs, neilb, bfields, Linus Torvalds,
chuck.lever, Andrew Morton
On Nov 2, 2007, at 9:28 AM, Kumar Gala wrote:
> On Thu, 25 Oct 2007, Trond Myklebust wrote:
>
>> Could you please try the following patch?
>>
>> Cheers
>> Trond
>
> Its a new month so I'll ping again about sending this fix upstream to
> linus for 2.6.24 :) ?
>
> - k
Trond,
any update on sending this to Linus for 2.6.24?
- k
>> --------------------------------- CUT HERE
>> -----------------------------
>> From: Trond Myklebust <Trond.Myklebust@netapp.com>
>> Date: Thu, 25 Oct 2007 13:56:10 -0400
>> NFS: Fix the ustat() regression
>>
>> Since 2.6.18, the superblock sb->s_root has been a dummy dentry
>> with a
>> dummy inode. This breaks ustat(), which actually uses sb->s_root in a
>> vfstat() call.
>>
>> Fix this by making the s_root a dummy alias to the directory inode
>> that was
>> used when creating the superblock.
>>
>> Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
>> ---
>>
>> fs/nfs/getroot.c | 81 +++++++++++++++++
>> +------------------------------------
>> 1 files changed, 27 insertions(+), 54 deletions(-)
>>
>> diff --git a/fs/nfs/getroot.c b/fs/nfs/getroot.c
>> index 522e5ad..0ee4384 100644
>> --- a/fs/nfs/getroot.c
>> +++ b/fs/nfs/getroot.c
>> @@ -43,6 +43,25 @@
>> #define NFSDBG_FACILITY NFSDBG_CLIENT
>>
>> /*
>> + * Set the superblock root dentry.
>> + * Note that this function frees the inode in case of error.
>> + */
>> +static int nfs_superblock_set_dummy_root(struct super_block *sb,
>> struct inode *inode)
>> +{
>> + /* The mntroot acts as the dummy root dentry for this superblock */
>> + if (sb->s_root == NULL) {
>> + sb->s_root = d_alloc_root(inode);
>> + if (sb->s_root == NULL) {
>> + iput(inode);
>> + return -ENOMEM;
>> + }
>> + /* Circumvent igrab(): we know the inode is not being freed */
>> + atomic_inc(&inode->i_count);
>> + }
>> + return 0;
>> +}
>> +
>> +/*
>> * get an NFS2/NFS3 root dentry from the root filehandle
>> */
>> struct dentry *nfs_get_root(struct super_block *sb, struct nfs_fh
>> *mntfh)
>> @@ -54,33 +73,6 @@ struct dentry *nfs_get_root(struct super_block
>> *sb, struct nfs_fh *mntfh)
>> struct inode *inode;
>> int error;
>>
>> - /* create a dummy root dentry with dummy inode for this
>> superblock */
>> - if (!sb->s_root) {
>> - struct nfs_fh dummyfh;
>> - struct dentry *root;
>> - struct inode *iroot;
>> -
>> - memset(&dummyfh, 0, sizeof(dummyfh));
>> - memset(&fattr, 0, sizeof(fattr));
>> - nfs_fattr_init(&fattr);
>> - fattr.valid = NFS_ATTR_FATTR;
>> - fattr.type = NFDIR;
>> - fattr.mode = S_IFDIR | S_IRUSR | S_IWUSR;
>> - fattr.nlink = 2;
>> -
>> - iroot = nfs_fhget(sb, &dummyfh, &fattr);
>> - if (IS_ERR(iroot))
>> - return ERR_PTR(PTR_ERR(iroot));
>> -
>> - root = d_alloc_root(iroot);
>> - if (!root) {
>> - iput(iroot);
>> - return ERR_PTR(-ENOMEM);
>> - }
>> -
>> - sb->s_root = root;
>> - }
>> -
>> /* get the actual root for this mount */
>> fsinfo.fattr = &fattr;
>>
>> @@ -96,6 +88,10 @@ struct dentry *nfs_get_root(struct super_block
>> *sb, struct nfs_fh *mntfh)
>> return ERR_PTR(PTR_ERR(inode));
>> }
>>
>> + error = nfs_superblock_set_dummy_root(sb, inode);
>> + if (error != 0)
>> + return ERR_PTR(error);
>> +
>> /* root dentries normally start off anonymous and get spliced in
>> later
>> * if the dentry tree reaches them; however if the dentry already
>> * exists, we'll pick it up at this point and use it as the root
>> @@ -241,33 +237,6 @@ struct dentry *nfs4_get_root(struct
>> super_block *sb, struct nfs_fh *mntfh)
>>
>> dprintk("--> nfs4_get_root()\n");
>>
>> - /* create a dummy root dentry with dummy inode for this
>> superblock */
>> - if (!sb->s_root) {
>> - struct nfs_fh dummyfh;
>> - struct dentry *root;
>> - struct inode *iroot;
>> -
>> - memset(&dummyfh, 0, sizeof(dummyfh));
>> - memset(&fattr, 0, sizeof(fattr));
>> - nfs_fattr_init(&fattr);
>> - fattr.valid = NFS_ATTR_FATTR;
>> - fattr.type = NFDIR;
>> - fattr.mode = S_IFDIR | S_IRUSR | S_IWUSR;
>> - fattr.nlink = 2;
>> -
>> - iroot = nfs_fhget(sb, &dummyfh, &fattr);
>> - if (IS_ERR(iroot))
>> - return ERR_PTR(PTR_ERR(iroot));
>> -
>> - root = d_alloc_root(iroot);
>> - if (!root) {
>> - iput(iroot);
>> - return ERR_PTR(-ENOMEM);
>> - }
>> -
>> - sb->s_root = root;
>> - }
>> -
>> /* get the info about the server and filesystem */
>> error = nfs4_server_capabilities(server, mntfh);
>> if (error < 0) {
>> @@ -289,6 +258,10 @@ struct dentry *nfs4_get_root(struct
>> super_block *sb, struct nfs_fh *mntfh)
>> return ERR_PTR(PTR_ERR(inode));
>> }
>>
>> + error = nfs_superblock_set_dummy_root(sb, inode);
>> + if (error != 0)
>> + return ERR_PTR(error);
>> +
>> /* root dentries normally start off anonymous and get spliced in
>> later
>> * if the dentry tree reaches them; however if the dentry already
>> * exists, we'll pick it up at this point and use it as the root
>>
> -
> To unsubscribe from this list: send the line "unsubscribe linux-
> kernel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at http://www.tux.org/lkml/
^ permalink raw reply [flat|nested] 12+ messages in thread