Skip to contentSkip to conversation

pnfs: improve "Server wrote zero bytes" error

PATCH In review Olga Kornievskaia 4 participants 5 messages Feb 19 – Feb 20

Subsystems (2)
lore
Share & tools
lore

Olga Kornievskaia

author reviewer
#0 lore raw

PATCH 1/1 pnfs: improve "Server wrote zero bytes" error

When a pnfs error occurs, the IO is retried against the MDS. However, the initial IO leads to the kernel logging "Serer wrote zero bytes" when in fact the MDS IO will not fail and thus the error misleads administrators that the system is experiencing issues.

Instead, recognize that a re-try-against-MDS type of error has occuried before printing the "Server wrote zero bytes" warning.

---
 fs/nfs/filelayout/filelayout.c | 1 +
 fs/nfs/write.c                 | 2 +-
 2 files changed, 2 insertions(+), 1 deletion(-)
fs/nfs/filelayout/filelayout.c +1 -0
index 5c4551117c58..2cf405c370b4 100644
@@ -323,6 +323,7 @@ static int filelayout_write_done_cb(struct rpc_task *task,
 
 	switch (err) {
 	case -NFS4ERR_RESET_TO_MDS:
+		hdr->pnfs_error = task->tk_status;
 		filelayout_reset_write(hdr);
 		return task->tk_status;
 	case -EAGAIN:
fs/nfs/write.c +1 -1
index 2d0e4a765aeb..8e8e3f8ef362 100644
@@ -1558,7 +1558,7 @@ static void nfs_writeback_result(struct rpc_task *task,
 		nfs_inc_stats(hdr->inode, NFSIOS_SHORTWRITE);
 
 		/* Has the server at least made some progress? */
-		if (resp->count == 0) {
+		if (resp->count == 0 && !hdr->pnfs_error) {
 			if (time_before(complain, jiffies)) {
 				printk(KERN_WARNING
 				       "NFS: Server wrote zero bytes, expected %u.\n",
Signature · 1 line
2.52.0
#1 lore raw

Hi Olga,

Quoted 39 lines · Olga Kornievskaia

When a pnfs error occurs, the IO is retried against the MDS. However, the initial IO leads to the kernel logging "Serer wrote zero bytes" when in fact the MDS IO will not fail and thus the error misleads administrators that the system is experiencing issues.

Instead, recognize that a re-try-against-MDS type of error has occuried before printing the "Server wrote zero bytes" warning.

---
 fs/nfs/filelayout/filelayout.c | 1 +
 fs/nfs/write.c                 | 2 +-

 2 files changed, 2 insertions(+), 1 deletion(-)
fs/nfs/filelayout/filelayout.c +0 -0
index 5c4551117c58..2cf405c370b4 100644
@@ -323,6 +323,7 @@ static int filelayout_write_done_cb(struct
 rpc_task *task,


  switch (err) {
  case -NFS4ERR_RESET_TO_MDS:

fs/nfs/filelayout/filelayout.c +1 -0
+		hdr->pnfs_error = task->tk_status;

  filelayout_reset_write(hdr);
  return task->tk_status;
  case -EAGAIN:

fs/nfs/write.c +0 -0
index 2d0e4a765aeb..8e8e3f8ef362 100644
@@ -1558,7 +1558,7 @@ static void nfs_writeback_result(struct
 rpc_task *task,
  		nfs_inc_stats(hdr->inode, NFSIOS_SHORTWRITE);


  /* Has the server at least made some progress? */

fs/nfs/write.c +1 -1
-		if (resp->count == 0) {
+		if (resp->count == 0 && !hdr->pnfs_error) {
Quoted 4 lines

  if (time_before(complain, jiffies)) { printk(KERN_WARNING "NFS: Server wrote zero bytes, expected %u.\n",

Hmm... Is this needed? Shouldn't the test for task->tk_status < 0 in nfs_pgio_result() ensure that we can't call nfs_writeback_result() in the above case?

Signature · 3 lines
Trond Myklebust
Linux NFS client maintainer, Hammerspace
[email protected], [email protected]
#2 lore raw
Quoted 40 lines · Trond Myklebust

Hi Olga,

Quoted 36 lines · Olga Kornievskaia

When a pnfs error occurs, the IO is retried against the MDS. However, the initial IO leads to the kernel logging "Serer wrote zero bytes" when in fact the MDS IO will not fail and thus the error misleads administrators that the system is experiencing issues.

Instead, recognize that a re-try-against-MDS type of error has occuried before printing the "Server wrote zero bytes" warning.

---
 fs/nfs/filelayout/filelayout.c | 1 +
 fs/nfs/write.c                 | 2 +-
 2 files changed, 2 insertions(+), 1 deletion(-)
fs/nfs/filelayout/filelayout.c +1 -0
index 5c4551117c58..2cf405c370b4 100644
@@ -323,6 +323,7 @@ static int filelayout_write_done_cb(struct
 rpc_task *task,
 
      switch (err) {
      case -NFS4ERR_RESET_TO_MDS:
+             hdr->pnfs_error = task->tk_status;
              filelayout_reset_write(hdr);
              return task->tk_status;

case -EAGAIN:

fs/nfs/write.c +0 -0
index 2d0e4a765aeb..8e8e3f8ef362 100644
@@ -1558,7 +1558,7 @@ static void nfs_writeback_result(struct
 rpc_task *task,
              nfs_inc_stats(hdr->inode, NFSIOS_SHORTWRITE);
 
Quoted 9 lines
Quoted 7 lines
fs/nfs/write.c +1 -1
              /* Has the server at least made some progress? */
-             if (resp->count == 0) {
+             if (resp->count == 0 && !hdr->pnfs_error) {
                      if (time_before(complain, jiffies)) {
                              printk(KERN_WARNING

"NFS: Server wrote zero
bytes, expected %u.\n",

Hmm... Is this needed? Shouldn't the test for task->tk_status < 0 in

task_status is 0 when it gets to nfs_writeback_done because in filelayout/filelayout.c in filelayout_reset_write() is doing this

task->tk_status = pnfs_write_done_resend_to_mds(hdr);

Quoted 7 lines

nfs_pgio_result() ensure that we can't call nfs_writeback_result() in the above case?

--
Trond Myklebust
Linux NFS client maintainer, Hammerspace [email protected], [email protected]

maintainer
#3 lore raw
Quoted 14 lines · Olga Kornievskaia
Quoted 3 lines · Trond Myklebust

Hmm... Is this needed? Shouldn't the test for task->tk_status < 0 in

task_status is 0 when it gets to nfs_writeback_done because in filelayout/filelayout.c in filelayout_reset_write() is doing this

task->tk_status = pnfs_write_done_resend_to_mds(hdr);

Quoted 3 lines

nfs_pgio_result() ensure that we can't call nfs_writeback_result() in
the above case?

Oh... So isn't the hdr->pages list actually empty? Should we even bother entering the short write condition when that happens?

IOW: Why not just change that test at the top of nfs_writeback_result() to read something like

	if (resp->count < argp->count && !list_empty(hdr->pages)) {
Signature · 3 lines
Trond Myklebust
Linux NFS client maintainer, Hammerspace
[email protected], [email protected]
#4 lore raw
Quoted 17 lines · Trond Myklebust
Quoted 14 lines · Olga Kornievskaia
Quoted 3 lines · Trond Myklebust

Hmm... Is this needed? Shouldn't the test for task->tk_status < 0 in

task_status is 0 when it gets to nfs_writeback_done because in filelayout/filelayout.c in filelayout_reset_write() is doing this

task->tk_status = pnfs_write_done_resend_to_mds(hdr);

Quoted 3 lines

nfs_pgio_result() ensure that we can't call nfs_writeback_result() in
the above case?

Quoted 7 lines

Oh... So isn't the hdr->pages list actually empty? Should we even bother entering the short write condition when that happens?

IOW: Why not just change that test at the top of nfs_writeback_result() to read something like

        if (resp->count < argp->count && !list_empty(hdr->pages)) {

Thank you for the suggestion. A generic approach like you are suggesting is definitely better. I have tested it and it solves the problem. I can send a v2 tomorrow.

Quoted 7 lines

--
Trond Myklebust
Linux NFS client maintainer, Hammerspace [email protected], [email protected]