Re: [PATCH] nfs: don't update isize when NFS_INO_LAYOUTCOMMITTING in nfs_update_inode

2014-01-13 Thread Trond Myklebust

On Jan 13, 2014, at 8:34, Trond Myklebust  
wrote:

> 
> On Jan 13, 2014, at 2:55, shaobingqing  wrote:
> 
>> When a file is in NFS_INO_LAYOUTCOMMITING status, its isize perhaps has not 
>> been 
>> transferred to the metadate server. So the isize getting from the metadata 
>> server
>> perhaps is out of date and cannot be used to update the isize of the client.
>> 
>> Signed-off-by: shaobingqing 
>> ---
>> fs/nfs/inode.c |3 ++-
>> 1 files changed, 2 insertions(+), 1 deletions(-)
>> 
>> diff --git a/fs/nfs/inode.c b/fs/nfs/inode.c
>> index ebeb94c..caf50a1 100644
>> --- a/fs/nfs/inode.c
>> +++ b/fs/nfs/inode.c
>> @@ -1402,7 +1402,8 @@ static int nfs_update_inode(struct inode *inode, 
>> struct nfs_fattr *fattr)
>>  if (new_isize != cur_isize) {
>>  /* Do we perhaps have any outstanding writes, or has
>>   * the file grown beyond our last write? */
>> -if ((nfsi->npages == 0 && 
>> !test_bit(NFS_INO_LAYOUTCOMMIT, >flags)) ||
>> +if ((nfsi->npages == 0 && 
>> !test_bit(NFS_INO_LAYOUTCOMMIT, >flags) &&
>> + !test_bit(NFS_INO_LAYOUTCOMMITTING, >flags)) 
>> ||
>>   new_isize > cur_isize) {
>>  i_size_write(inode, new_isize);
>>  invalid |= 
>> NFS_INO_INVALID_ATTR|NFS_INO_INVALID_DATA;
> 
> Ugh. Is there any reason why we can’t just keep NFS_INO_LAYOUTCOMMIT set 
> until the layout commit operation is finished instead of multiplying the 
> tests for it in generic NFS code paths such as nfs_update_inode?

Actually, no. The above is bogus, because LAYOUTCOMMIT doesn’t just affect the 
file size: it affects the NFSv4 change attribute, ctime and mtime values too.

I’ll draft a patch...

--
Trond Myklebust
Linux NFS client maintainer

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] nfs: don't update isize when NFS_INO_LAYOUTCOMMITTING in nfs_update_inode

2014-01-13 Thread Trond Myklebust

On Jan 13, 2014, at 2:55, shaobingqing  wrote:

> When a file is in NFS_INO_LAYOUTCOMMITING status, its isize perhaps has not 
> been 
> transferred to the metadate server. So the isize getting from the metadata 
> server
> perhaps is out of date and cannot be used to update the isize of the client.
> 
> Signed-off-by: shaobingqing 
> ---
> fs/nfs/inode.c |3 ++-
> 1 files changed, 2 insertions(+), 1 deletions(-)
> 
> diff --git a/fs/nfs/inode.c b/fs/nfs/inode.c
> index ebeb94c..caf50a1 100644
> --- a/fs/nfs/inode.c
> +++ b/fs/nfs/inode.c
> @@ -1402,7 +1402,8 @@ static int nfs_update_inode(struct inode *inode, struct 
> nfs_fattr *fattr)
>   if (new_isize != cur_isize) {
>   /* Do we perhaps have any outstanding writes, or has
>* the file grown beyond our last write? */
> - if ((nfsi->npages == 0 && 
> !test_bit(NFS_INO_LAYOUTCOMMIT, >flags)) ||
> + if ((nfsi->npages == 0 && 
> !test_bit(NFS_INO_LAYOUTCOMMIT, >flags) &&
> +  !test_bit(NFS_INO_LAYOUTCOMMITTING, >flags)) 
> ||
>new_isize > cur_isize) {
>   i_size_write(inode, new_isize);
>   invalid |= 
> NFS_INO_INVALID_ATTR|NFS_INO_INVALID_DATA;

Ugh. Is there any reason why we can’t just keep NFS_INO_LAYOUTCOMMIT set until 
the layout commit operation is finished instead of multiplying the tests for it 
in generic NFS code paths such as nfs_update_inode?

--
Trond Myklebust
Linux NFS client maintainer

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH] nfs: don't update isize when NFS_INO_LAYOUTCOMMITTING in nfs_update_inode

2014-01-13 Thread shaobingqing
When a file is in NFS_INO_LAYOUTCOMMITING status, its isize perhaps has not 
been 
transferred to the metadate server. So the isize getting from the metadata 
server
perhaps is out of date and cannot be used to update the isize of the client.

Signed-off-by: shaobingqing 
---
 fs/nfs/inode.c |3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/fs/nfs/inode.c b/fs/nfs/inode.c
index ebeb94c..caf50a1 100644
--- a/fs/nfs/inode.c
+++ b/fs/nfs/inode.c
@@ -1402,7 +1402,8 @@ static int nfs_update_inode(struct inode *inode, struct 
nfs_fattr *fattr)
if (new_isize != cur_isize) {
/* Do we perhaps have any outstanding writes, or has
 * the file grown beyond our last write? */
-   if ((nfsi->npages == 0 && 
!test_bit(NFS_INO_LAYOUTCOMMIT, >flags)) ||
+   if ((nfsi->npages == 0 && 
!test_bit(NFS_INO_LAYOUTCOMMIT, >flags) &&
+!test_bit(NFS_INO_LAYOUTCOMMITTING, >flags)) 
||
 new_isize > cur_isize) {
i_size_write(inode, new_isize);
invalid |= 
NFS_INO_INVALID_ATTR|NFS_INO_INVALID_DATA;
-- 
1.7.4.2

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH] nfs: don't update isize when NFS_INO_LAYOUTCOMMITTING in nfs_update_inode

2014-01-13 Thread shaobingqing
When a file is in NFS_INO_LAYOUTCOMMITING status, its isize perhaps has not 
been 
transferred to the metadate server. So the isize getting from the metadata 
server
perhaps is out of date and cannot be used to update the isize of the client.

Signed-off-by: shaobingqing shaobingq...@bwstor.com.cn
---
 fs/nfs/inode.c |3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/fs/nfs/inode.c b/fs/nfs/inode.c
index ebeb94c..caf50a1 100644
--- a/fs/nfs/inode.c
+++ b/fs/nfs/inode.c
@@ -1402,7 +1402,8 @@ static int nfs_update_inode(struct inode *inode, struct 
nfs_fattr *fattr)
if (new_isize != cur_isize) {
/* Do we perhaps have any outstanding writes, or has
 * the file grown beyond our last write? */
-   if ((nfsi-npages == 0  
!test_bit(NFS_INO_LAYOUTCOMMIT, nfsi-flags)) ||
+   if ((nfsi-npages == 0  
!test_bit(NFS_INO_LAYOUTCOMMIT, nfsi-flags) 
+!test_bit(NFS_INO_LAYOUTCOMMITTING, nfsi-flags)) 
||
 new_isize  cur_isize) {
i_size_write(inode, new_isize);
invalid |= 
NFS_INO_INVALID_ATTR|NFS_INO_INVALID_DATA;
-- 
1.7.4.2

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] nfs: don't update isize when NFS_INO_LAYOUTCOMMITTING in nfs_update_inode

2014-01-13 Thread Trond Myklebust

On Jan 13, 2014, at 2:55, shaobingqing shaobingq...@bwstor.com.cn wrote:

 When a file is in NFS_INO_LAYOUTCOMMITING status, its isize perhaps has not 
 been 
 transferred to the metadate server. So the isize getting from the metadata 
 server
 perhaps is out of date and cannot be used to update the isize of the client.
 
 Signed-off-by: shaobingqing shaobingq...@bwstor.com.cn
 ---
 fs/nfs/inode.c |3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)
 
 diff --git a/fs/nfs/inode.c b/fs/nfs/inode.c
 index ebeb94c..caf50a1 100644
 --- a/fs/nfs/inode.c
 +++ b/fs/nfs/inode.c
 @@ -1402,7 +1402,8 @@ static int nfs_update_inode(struct inode *inode, struct 
 nfs_fattr *fattr)
   if (new_isize != cur_isize) {
   /* Do we perhaps have any outstanding writes, or has
* the file grown beyond our last write? */
 - if ((nfsi-npages == 0  
 !test_bit(NFS_INO_LAYOUTCOMMIT, nfsi-flags)) ||
 + if ((nfsi-npages == 0  
 !test_bit(NFS_INO_LAYOUTCOMMIT, nfsi-flags) 
 +  !test_bit(NFS_INO_LAYOUTCOMMITTING, nfsi-flags)) 
 ||
new_isize  cur_isize) {
   i_size_write(inode, new_isize);
   invalid |= 
 NFS_INO_INVALID_ATTR|NFS_INO_INVALID_DATA;

Ugh. Is there any reason why we can’t just keep NFS_INO_LAYOUTCOMMIT set until 
the layout commit operation is finished instead of multiplying the tests for it 
in generic NFS code paths such as nfs_update_inode?

--
Trond Myklebust
Linux NFS client maintainer

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] nfs: don't update isize when NFS_INO_LAYOUTCOMMITTING in nfs_update_inode

2014-01-13 Thread Trond Myklebust

On Jan 13, 2014, at 8:34, Trond Myklebust trond.mykleb...@primarydata.com 
wrote:

 
 On Jan 13, 2014, at 2:55, shaobingqing shaobingq...@bwstor.com.cn wrote:
 
 When a file is in NFS_INO_LAYOUTCOMMITING status, its isize perhaps has not 
 been 
 transferred to the metadate server. So the isize getting from the metadata 
 server
 perhaps is out of date and cannot be used to update the isize of the client.
 
 Signed-off-by: shaobingqing shaobingq...@bwstor.com.cn
 ---
 fs/nfs/inode.c |3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)
 
 diff --git a/fs/nfs/inode.c b/fs/nfs/inode.c
 index ebeb94c..caf50a1 100644
 --- a/fs/nfs/inode.c
 +++ b/fs/nfs/inode.c
 @@ -1402,7 +1402,8 @@ static int nfs_update_inode(struct inode *inode, 
 struct nfs_fattr *fattr)
  if (new_isize != cur_isize) {
  /* Do we perhaps have any outstanding writes, or has
   * the file grown beyond our last write? */
 -if ((nfsi-npages == 0  
 !test_bit(NFS_INO_LAYOUTCOMMIT, nfsi-flags)) ||
 +if ((nfsi-npages == 0  
 !test_bit(NFS_INO_LAYOUTCOMMIT, nfsi-flags) 
 + !test_bit(NFS_INO_LAYOUTCOMMITTING, nfsi-flags)) 
 ||
   new_isize  cur_isize) {
  i_size_write(inode, new_isize);
  invalid |= 
 NFS_INO_INVALID_ATTR|NFS_INO_INVALID_DATA;
 
 Ugh. Is there any reason why we can’t just keep NFS_INO_LAYOUTCOMMIT set 
 until the layout commit operation is finished instead of multiplying the 
 tests for it in generic NFS code paths such as nfs_update_inode?

Actually, no. The above is bogus, because LAYOUTCOMMIT doesn’t just affect the 
file size: it affects the NFSv4 change attribute, ctime and mtime values too.

I’ll draft a patch...

--
Trond Myklebust
Linux NFS client maintainer

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/