diff mbox

NFS: Add "device" tag to /proc/self/mountstats

Message ID 4E5807A8.2020600@netapp.com (mailing list archive)
State New, archived
Headers show

Commit Message

Bryan Schumaker Aug. 26, 2011, 8:52 p.m. UTC
nfsiostat was failing to find mounted filesystems on recent kernels due
to changes in the VFS that resulted in a missing "device" tag in the
/proc/self/mountstats file.  This patch re-adds the "device" tag for NFS
mount data in /proc/self/mountstats.

Signed-off-by: Bryan Schumaker <bjschuma@netapp.com>
---
 fs/nfs/super.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

Comments

Chuck Lever Aug. 27, 2011, 11:52 p.m. UTC | #1
On Aug 26, 2011, at 4:52 PM, Bryan Schumaker wrote:

> nfsiostat was failing to find mounted filesystems on recent kernels due
> to changes in the VFS that resulted in a missing "device" tag in the
> /proc/self/mountstats file.

What was the commit ID that changed this formal kernel API?  I'd like to see the justification.

> This patch re-adds the "device" tag for NFS
> mount data in /proc/self/mountstats.

The purpose of mountstats is to be an interface that all file systems can use.  If we can't add "device" back to all mounts listed in /proc/self/mountstats, it might be better to adjust nfsiostats to cope.

> Signed-off-by: Bryan Schumaker <bjschuma@netapp.com>
> ---
> fs/nfs/super.c |    4 +++-
> 1 files changed, 3 insertions(+), 1 deletions(-)
> 
> diff --git a/fs/nfs/super.c b/fs/nfs/super.c
> index b961cea..e6a0317 100644
> --- a/fs/nfs/super.c
> +++ b/fs/nfs/super.c
> @@ -766,8 +766,10 @@ static int nfs_show_devname(struct seq_file *m, struct vfsmount *mnt)
> 	devname = nfs_path(&dummy, mnt->mnt_root, page, PAGE_SIZE);
> 	if (IS_ERR(devname))
> 		err = PTR_ERR(devname);
> -	else
> +	else {
> +		seq_puts(m, "device ");
> 		seq_escape(m, devname, " \t\n\\");
> +	}
> 	free_page((unsigned long)page);
> 	return err;
> }
> -- 
> 1.7.6
Bryan Schumaker Aug. 29, 2011, 1:46 p.m. UTC | #2
On 08/27/2011 07:52 PM, Chuck Lever wrote:
> 
> On Aug 26, 2011, at 4:52 PM, Bryan Schumaker wrote:
> 
>> nfsiostat was failing to find mounted filesystems on recent kernels due
>> to changes in the VFS that resulted in a missing "device" tag in the
>> /proc/self/mountstats file.
> 
> What was the commit ID that changed this formal kernel API?  I'd like to see the justification.

It was changed by this commit:

commit c7f404b40a3665d9f4e9a927cc5c1ee0479ed8f9
Author: Al Viro <viro@zeniv.linux.org.uk>
Date:   Wed Mar 16 06:59:40 2011 -0400

    vfs: new superblock methods to override /proc/*/mount{s,info}
    
    a) ->show_devname(m, mnt) - what to put into devname columns in mounts,
    mountinfo and mountstats
    b) ->show_path(m, mnt) - what to put into relative path column in mountinfo
    
    Leaving those NULL gives old behaviour.  NFS switched to using those.
    
    Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>


> 
>> This patch re-adds the "device" tag for NFS
>> mount data in /proc/self/mountstats.
> 
> The purpose of mountstats is to be an interface that all file systems can use.  If we can't add "device" back to all mounts listed in /proc/self/mountstats, it might be better to adjust nfsiostats to cope.
> 
>> Signed-off-by: Bryan Schumaker <bjschuma@netapp.com>
>> ---
>> fs/nfs/super.c |    4 +++-
>> 1 files changed, 3 insertions(+), 1 deletions(-)
>>
>> diff --git a/fs/nfs/super.c b/fs/nfs/super.c
>> index b961cea..e6a0317 100644
>> --- a/fs/nfs/super.c
>> +++ b/fs/nfs/super.c
>> @@ -766,8 +766,10 @@ static int nfs_show_devname(struct seq_file *m, struct vfsmount *mnt)
>> 	devname = nfs_path(&dummy, mnt->mnt_root, page, PAGE_SIZE);
>> 	if (IS_ERR(devname))
>> 		err = PTR_ERR(devname);
>> -	else
>> +	else {
>> +		seq_puts(m, "device ");
>> 		seq_escape(m, devname, " \t\n\\");
>> +	}
>> 	free_page((unsigned long)page);
>> 	return err;
>> }
>> -- 
>> 1.7.6
> 

--
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
Chuck Lever Aug. 29, 2011, 2:43 p.m. UTC | #3
On Aug 29, 2011, at 9:46 AM, Bryan Schumaker wrote:

> On 08/27/2011 07:52 PM, Chuck Lever wrote:
>> 
>> On Aug 26, 2011, at 4:52 PM, Bryan Schumaker wrote:
>> 
>>> nfsiostat was failing to find mounted filesystems on recent kernels due
>>> to changes in the VFS that resulted in a missing "device" tag in the
>>> /proc/self/mountstats file.
>> 
>> What was the commit ID that changed this formal kernel API?  I'd like to see the justification.
> 
> It was changed by this commit:
> 
> commit c7f404b40a3665d9f4e9a927cc5c1ee0479ed8f9
> Author: Al Viro <viro@zeniv.linux.org.uk>
> Date:   Wed Mar 16 06:59:40 2011 -0400
> 
>    vfs: new superblock methods to override /proc/*/mount{s,info}
> 
>    a) ->show_devname(m, mnt) - what to put into devname columns in mounts,
>    mountinfo and mountstats
>    b) ->show_path(m, mnt) - what to put into relative path column in mountinfo
> 
>    Leaving those NULL gives old behaviour.  NFS switched to using those.
> 
>    Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>

It looks like dropping the "device" tag from /proc/self/mountstats was not intentional, so this is a kernel API regression.  At a guess, 2.6.39 probably works right, but 3.0 is broken.  Whatever solution we come up with might need to be cc:d to stable@kernel.org.  Be sure to verify which released kernels are broken.

Does changing nfs_show_devname() to add a "device" tag have any effect on the other two /proc files (mounts and mountinfo)?  I suspect you do want to fix show_vfsstat() instead of nfs_show_devname().  This should add "device" only where it is needed, and would work for all file systems.

> 
> 
>> 
>>> This patch re-adds the "device" tag for NFS
>>> mount data in /proc/self/mountstats.
>> 
>> The purpose of mountstats is to be an interface that all file systems can use.  If we can't add "device" back to all mounts listed in /proc/self/mountstats, it might be better to adjust nfsiostats to cope.
>> 
>>> Signed-off-by: Bryan Schumaker <bjschuma@netapp.com>
>>> ---
>>> fs/nfs/super.c |    4 +++-
>>> 1 files changed, 3 insertions(+), 1 deletions(-)
>>> 
>>> diff --git a/fs/nfs/super.c b/fs/nfs/super.c
>>> index b961cea..e6a0317 100644
>>> --- a/fs/nfs/super.c
>>> +++ b/fs/nfs/super.c
>>> @@ -766,8 +766,10 @@ static int nfs_show_devname(struct seq_file *m, struct vfsmount *mnt)
>>> 	devname = nfs_path(&dummy, mnt->mnt_root, page, PAGE_SIZE);
>>> 	if (IS_ERR(devname))
>>> 		err = PTR_ERR(devname);
>>> -	else
>>> +	else {
>>> +		seq_puts(m, "device ");
>>> 		seq_escape(m, devname, " \t\n\\");
>>> +	}
>>> 	free_page((unsigned long)page);
>>> 	return err;
>>> }
>>> -- 
>>> 1.7.6
>> 
>
diff mbox

Patch

diff --git a/fs/nfs/super.c b/fs/nfs/super.c
index b961cea..e6a0317 100644
--- a/fs/nfs/super.c
+++ b/fs/nfs/super.c
@@ -766,8 +766,10 @@  static int nfs_show_devname(struct seq_file *m, struct vfsmount *mnt)
 	devname = nfs_path(&dummy, mnt->mnt_root, page, PAGE_SIZE);
 	if (IS_ERR(devname))
 		err = PTR_ERR(devname);
-	else
+	else {
+		seq_puts(m, "device ");
 		seq_escape(m, devname, " \t\n\\");
+	}
 	free_page((unsigned long)page);
 	return err;
 }