diff mbox

[Version,4,2/5] NFS: Warn when attempting a buffered write or commit with an expired credential

Message ID 1374176130-11657-3-git-send-email-andros@netapp.com (mailing list archive)
State New, archived
Headers show

Commit Message

Andy Adamson July 18, 2013, 7:35 p.m. UTC
From: Andy Adamson <andros@netapp.com>

Signed-off-by: Andy Adamson <andros@netapp.com>
---
 fs/nfs/write.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

Comments

Trond Myklebust Aug. 7, 2013, 6:54 p.m. UTC | #1
On Thu, 2013-07-18 at 15:35 -0400, andros@netapp.com wrote:
> From: Andy Adamson <andros@netapp.com>

> 

> Signed-off-by: Andy Adamson <andros@netapp.com>

> ---

>  fs/nfs/write.c | 10 ++++++++++

>  1 file changed, 10 insertions(+)

> 

> diff --git a/fs/nfs/write.c b/fs/nfs/write.c

> index f1bdb72..724c845 100644

> --- a/fs/nfs/write.c

> +++ b/fs/nfs/write.c

> @@ -1330,6 +1330,14 @@ void nfs_writeback_done(struct rpc_task *task, struct nfs_write_data *data)

>  	dprintk("NFS: %5u nfs_writeback_done (status %d)\n",

>  		task->tk_pid, task->tk_status);

>  

> +	if (task->tk_status == -EKEYEXPIRED)

> +		pr_warn("NFS:	write attempt with expired credential "

> +			"req %s/%lld, %u bytes @ offset %llu\n",

> +			inode->i_sb->s_id,

> +			(long long)NFS_FILEID(inode),

> +			data->args.count,

> +			(unsigned long long)data->args.offset);


This needs to be ratelimited to avoid trouble with syslog.

> +

>  	/*

>  	 * ->write_done will attempt to use post-op attributes to detect

>  	 * conflicting writes by other clients.  A strict interpretation

> @@ -1556,6 +1564,8 @@ static void nfs_commit_done(struct rpc_task *task, void *calldata)

>  

>          dprintk("NFS: %5u nfs_commit_done (status %d)\n",

>                                  task->tk_pid, task->tk_status);

> +	if (task->tk_status == -EKEYEXPIRED)

> +		pr_warn("NFS: commit attempt with expired credential\n");


Again, this wants to be rate limited.

>  

>  	/* Call the NFS version-specific code */

>  	NFS_PROTO(data->inode)->commit_done(task, data);


-- 
Trond Myklebust
Linux NFS client maintainer

NetApp
Trond.Myklebust@netapp.com
www.netapp.com
diff mbox

Patch

diff --git a/fs/nfs/write.c b/fs/nfs/write.c
index f1bdb72..724c845 100644
--- a/fs/nfs/write.c
+++ b/fs/nfs/write.c
@@ -1330,6 +1330,14 @@  void nfs_writeback_done(struct rpc_task *task, struct nfs_write_data *data)
 	dprintk("NFS: %5u nfs_writeback_done (status %d)\n",
 		task->tk_pid, task->tk_status);
 
+	if (task->tk_status == -EKEYEXPIRED)
+		pr_warn("NFS:	write attempt with expired credential "
+			"req %s/%lld, %u bytes @ offset %llu\n",
+			inode->i_sb->s_id,
+			(long long)NFS_FILEID(inode),
+			data->args.count,
+			(unsigned long long)data->args.offset);
+
 	/*
 	 * ->write_done will attempt to use post-op attributes to detect
 	 * conflicting writes by other clients.  A strict interpretation
@@ -1556,6 +1564,8 @@  static void nfs_commit_done(struct rpc_task *task, void *calldata)
 
         dprintk("NFS: %5u nfs_commit_done (status %d)\n",
                                 task->tk_pid, task->tk_status);
+	if (task->tk_status == -EKEYEXPIRED)
+		pr_warn("NFS: commit attempt with expired credential\n");
 
 	/* Call the NFS version-specific code */
 	NFS_PROTO(data->inode)->commit_done(task, data);