diff mbox

[1/1] Recover from stateid-type error on SETATTR

Message ID CAN-5tyHy+M4i2W+coBNXYxz-Ta3grYx=E+3vw7Y9=HE9heGjZQ@mail.gmail.com (mailing list archive)
State New, archived
Headers show

Commit Message

Olga Kornievskaia April 21, 2015, 10:36 p.m. UTC
Client can receives stateid-type error (eg., BAD_STATEID) on SETATTR
when delegation stateid was used. When no open state exists, in case
of application calling truncate() on the file, client has no state to
recover and fails with EIO.

Instead, upon such error, return the bad delegation and then resend the
SETATTR with a zero stateid. In general, when something calls
nfs4_handle_exception() with a null state, the operation should be
retried after bad delegation is removed.

Signed-off: Olga Kornievskaia <kolga@netapp.com>
---
 fs/nfs/nfs4proc.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

                 break;
--
--
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

Comments

Olga Kornievskaia April 27, 2015, 5:48 p.m. UTC | #1
Any comments on this patch?

On Tue, Apr 21, 2015 at 6:36 PM, Olga Kornievskaia <aglo@umich.edu> wrote:
> Client can receives stateid-type error (eg., BAD_STATEID) on SETATTR
> when delegation stateid was used. When no open state exists, in case
> of application calling truncate() on the file, client has no state to
> recover and fails with EIO.
>
> Instead, upon such error, return the bad delegation and then resend the
> SETATTR with a zero stateid. In general, when something calls
> nfs4_handle_exception() with a null state, the operation should be
> retried after bad delegation is removed.
>
> Signed-off: Olga Kornievskaia <kolga@netapp.com>
> ---
>  fs/nfs/nfs4proc.c | 5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)
>
> diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c
> index ad7cf7e..fbde292 100644
> --- a/fs/nfs/nfs4proc.c
> +++ b/fs/nfs/nfs4proc.c
> @@ -360,8 +360,11 @@ static int nfs4_handle_exception(struct
> nfs_server *server, int errorcode, struc
>          case -NFS4ERR_DELEG_REVOKED:
>          case -NFS4ERR_ADMIN_REVOKED:
>          case -NFS4ERR_BAD_STATEID:
> -            if (state == NULL)
> +            if (state == NULL) {
> +                nfs4_inode_return_delegation(inode);
> +                exception->retry = 1;
>                  break;
> +            }
>              ret = nfs4_schedule_stateid_recovery(server, state);
>              if (ret < 0)
>                  break;
> --
--
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
Olga Kornievskaia May 4, 2015, 4:24 p.m. UTC | #2
Trond,

Can you provide comments on this patch? Thanks.

On Mon, Apr 27, 2015 at 1:48 PM, Olga Kornievskaia <aglo@umich.edu> wrote:
> Any comments on this patch?
>
> On Tue, Apr 21, 2015 at 6:36 PM, Olga Kornievskaia <aglo@umich.edu> wrote:
>> Client can receives stateid-type error (eg., BAD_STATEID) on SETATTR
>> when delegation stateid was used. When no open state exists, in case
>> of application calling truncate() on the file, client has no state to
>> recover and fails with EIO.
>>
>> Instead, upon such error, return the bad delegation and then resend the
>> SETATTR with a zero stateid. In general, when something calls
>> nfs4_handle_exception() with a null state, the operation should be
>> retried after bad delegation is removed.
>>
>> Signed-off: Olga Kornievskaia <kolga@netapp.com>
>> ---
>>  fs/nfs/nfs4proc.c | 5 ++++-
>>  1 file changed, 4 insertions(+), 1 deletion(-)
>>
>> diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c
>> index ad7cf7e..fbde292 100644
>> --- a/fs/nfs/nfs4proc.c
>> +++ b/fs/nfs/nfs4proc.c
>> @@ -360,8 +360,11 @@ static int nfs4_handle_exception(struct
>> nfs_server *server, int errorcode, struc
>>          case -NFS4ERR_DELEG_REVOKED:
>>          case -NFS4ERR_ADMIN_REVOKED:
>>          case -NFS4ERR_BAD_STATEID:
>> -            if (state == NULL)
>> +            if (state == NULL) {
>> +                nfs4_inode_return_delegation(inode);
>> +                exception->retry = 1;
>>                  break;
>> +            }
>>              ret = nfs4_schedule_stateid_recovery(server, state);
>>              if (ret < 0)
>>                  break;
>> --
--
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/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c
index ad7cf7e..fbde292 100644
--- a/fs/nfs/nfs4proc.c
+++ b/fs/nfs/nfs4proc.c
@@ -360,8 +360,11 @@  static int nfs4_handle_exception(struct
nfs_server *server, int errorcode, struc
         case -NFS4ERR_DELEG_REVOKED:
         case -NFS4ERR_ADMIN_REVOKED:
         case -NFS4ERR_BAD_STATEID:
-            if (state == NULL)
+            if (state == NULL) {
+                nfs4_inode_return_delegation(inode);
+                exception->retry = 1;
                 break;
+            }
             ret = nfs4_schedule_stateid_recovery(server, state);
             if (ret < 0)