From 0d7aad2739466355043bd2fc7717513d9ec65140 Mon Sep 17 00:00:00 2001 From: Steve French Date: Thu, 21 Aug 2003 01:08:44 -0700 Subject: [PATCH] retry socket write on EAGAIN. Fix oops in write when tcp session dead. --- fs/cifs/CHANGES | 10 ++++++++++ fs/cifs/cifssmb.c | 7 +++++++ fs/cifs/connect.c | 4 ++-- fs/cifs/dir.c | 1 - fs/cifs/transport.c | 2 +- 5 files changed, 20 insertions(+), 4 deletions(-) diff --git a/fs/cifs/CHANGES b/fs/cifs/CHANGES index 2a58939fb9ba4..1905748d3b584 100644 --- a/fs/cifs/CHANGES +++ b/fs/cifs/CHANGES @@ -1,3 +1,13 @@ +Version 0.89 +------------ +Fix oops on write to dead tcp session. + +Version 0.88 +------------ +Fix non-POSIX behavior on rename of open file and delete of open file by taking +advantage of trans2 SetFileInfo rename facility if available on target server. +Retry on ENOSPC and EAGAIN socket errors. + Version 0.87 ------------ Fix oops on big endian readdir. Set blksize to be even power of two (2**blkbits) to fix diff --git a/fs/cifs/cifssmb.c b/fs/cifs/cifssmb.c index 202caf6f5367a..9643932c9df20 100644 --- a/fs/cifs/cifssmb.c +++ b/fs/cifs/cifssmb.c @@ -526,6 +526,10 @@ CIFSSMBRead(const int xid, struct cifsTconInfo *tcon, if (rc) return rc; + /* tcon and ses pointer are checked in smb_init */ + if (tcon->ses->server == NULL) + return -ECONNABORTED; + pSMB->AndXCommand = 0xFF; /* none */ pSMB->Fid = netfid; pSMB->OffsetLow = cpu_to_le32(lseek & 0xFFFFFFFF); @@ -584,6 +588,9 @@ CIFSSMBWrite(const int xid, struct cifsTconInfo *tcon, (void **) &pSMBr); if (rc) return rc; + /* tcon and ses pointer are checked in smb_init */ + if (tcon->ses->server == NULL) + return -ECONNABORTED; pSMB->AndXCommand = 0xFF; /* none */ pSMB->Fid = netfid; diff --git a/fs/cifs/connect.c b/fs/cifs/connect.c index ea5f342e2386d..81151b4256943 100644 --- a/fs/cifs/connect.c +++ b/fs/cifs/connect.c @@ -233,9 +233,9 @@ cifs_demultiplex_thread(struct TCP_Server_Info *server) (checkSMBhdr (smb_buffer, smb_buffer->Mid))) { cERROR(1, - (KERN_ERR - "Invalid size or format for SMB found with length %d and pdu_lenght %d", + ("Invalid size or format for SMB found with length %d and pdu_lenght %d", length, pdu_length)); + cifs_dump_mem("Received Data is: ",temp,sizeof(struct smb_hdr)); /* BB fix by finding next smb signature - and reading off data until next smb ? BB */ /* BB add reconnect here */ diff --git a/fs/cifs/dir.c b/fs/cifs/dir.c index ba00aa2672e33..7795f24d90b4c 100644 --- a/fs/cifs/dir.c +++ b/fs/cifs/dir.c @@ -51,7 +51,6 @@ build_path_from_dentry(struct dentry *direntry) for (temp = direntry; !IS_ROOT(temp);) { namelen += (1 + temp->d_name.len); - cFYI(1, (" len %d ", namelen)); temp = temp->d_parent; } namelen += 1; /* allow for trailing null */ diff --git a/fs/cifs/transport.c b/fs/cifs/transport.c index 7d5a07eb208b6..1e037749e8f4a 100644 --- a/fs/cifs/transport.c +++ b/fs/cifs/transport.c @@ -169,7 +169,7 @@ smb_send(struct socket *ssocket, struct smb_hdr *smb_buffer, temp_fs = get_fs(); /* we must turn off socket api parm checking */ set_fs(get_ds()); rc = sock_sendmsg(ssocket, &smb_msg, smb_buf_length + 4); - while(rc == -ENOSPC) { + while((rc == -ENOSPC) || (rc == -EAGAIN)) { schedule_timeout(HZ/2); rc = sock_sendmsg(ssocket, &smb_msg, smb_buf_length + 4); } -- 2.53.0