From patchwork Tue May 25 22:24:18 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shirish Pargaonkar X-Patchwork-Id: 102303 Received: from lists.samba.org (fn.samba.org [216.83.154.106]) by demeter.kernel.org (8.14.3/8.14.3) with ESMTP id o4PMRF0I010897 for ; Tue, 25 May 2010 22:27:51 GMT Received: from fn.samba.org (localhost [127.0.0.1]) by lists.samba.org (Postfix) with ESMTP id B5837AD10C; Tue, 25 May 2010 16:27:16 -0600 (MDT) X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on fn.samba.org X-Spam-Level: X-Spam-Status: No, score=-4.1 required=3.8 tests=BAYES_00,SPF_PASS autolearn=ham version=3.2.5 X-Original-To: linux-cifs-client@lists.samba.org Delivered-To: linux-cifs-client@lists.samba.org Received: from mail-gy0-f169.google.com (mail-gy0-f169.google.com [209.85.160.169]) by lists.samba.org (Postfix) with ESMTP id D1DE4AD071 for ; Tue, 25 May 2010 16:27:10 -0600 (MDT) Received: by gyg4 with SMTP id 4so2473279gyg.14 for ; Tue, 25 May 2010 15:27:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:from:to:cc:subject:date :message-id:x-mailer; bh=oOTWy9oHZr2bs/lRLnxRAMgjKmIsy92DwO6hc2hdut0=; b=nB7DGrkHyXOXcgTG46+2wRByLrIRx//D6GPXwTmEntSTg8IsinSFIl+0MYymdIgSGM XUv8j2H3gxaKO1Gg02hB8TVchWfgPABecJT9E3YVDcNKeXt381e8RH5lj69v/KnC0M4g NQEkEl3XHoqbRxQosJG7yIsVcGYw8s6XwdKUE= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=from:to:cc:subject:date:message-id:x-mailer; b=K9hiZExy489azmeWBKO7rzua3fG5L9e8jDNmdnHlaT4FBSmf3MzLo8q37ZJP45yKSG omVgeuoCVyupICMM+koWaNAi6VuzKw5XidT37epVQ9ubaVBnPrVV2k9oWjmRvEUhRij4 VBLm2ouRybwAw65yES5LfS/pBYT9gk7tMi5sY= Received: by 10.150.187.19 with SMTP id k19mr8506157ybf.96.1274826428006; Tue, 25 May 2010 15:27:08 -0700 (PDT) Received: from localhost ([32.97.110.58]) by mx.google.com with ESMTPS id j1sm21271233ybe.18.2010.05.25.15.27.06 (version=TLSv1/SSLv3 cipher=RC4-MD5); Tue, 25 May 2010 15:27:07 -0700 (PDT) From: shirishpargaonkar@gmail.com To: linux-cifs-client@lists.samba.org Date: Tue, 25 May 2010 17:24:18 -0500 Message-Id: <1274826258-4256-1-git-send-email-shirishpargaonkar@gmail.com> X-Mailer: git-send-email 1.6.0.2 Cc: linux-fsdevel@vger.kernel.org Subject: [linux-cifs-client] [patch] [try 2] cifs: implement hard mount option behaviour X-BeenThere: linux-cifs-client@lists.samba.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: The Linux CIFS VFS client List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: linux-cifs-client-bounces@lists.samba.org Errors-To: linux-cifs-client-bounces@lists.samba.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.3 (demeter.kernel.org [140.211.167.41]); Tue, 25 May 2010 22:27:51 +0000 (UTC) diff --git a/fs/cifs/cifsproto.h b/fs/cifs/cifsproto.h index fb1657e..c362507 100644 --- a/fs/cifs/cifsproto.h +++ b/fs/cifs/cifsproto.h @@ -63,12 +63,13 @@ extern char *cifs_compose_mount_options(const char *sb_mountdata, extern int SendReceive(const unsigned int /* xid */ , struct cifsSesInfo *, struct smb_hdr * /* input */ , struct smb_hdr * /* out */ , - int * /* bytes returned */ , const int long_op); + int * /* bytes returned */ , const int long_op, bool); extern int SendReceiveNoRsp(const unsigned int xid, struct cifsSesInfo *ses, struct smb_hdr *in_buf, int flags); extern int SendReceive2(const unsigned int /* xid */ , struct cifsSesInfo *, struct kvec *, int /* nvec to send */, - int * /* type of buf returned */ , const int flags); + int * /* type of buf returned */ , const int flags, + bool); extern int SendReceiveBlockingLock(const unsigned int xid, struct cifsTconInfo *ptcon, struct smb_hdr *in_buf , diff --git a/fs/cifs/cifssmb.c b/fs/cifs/cifssmb.c index c65c341..da80ad4 100644 --- a/fs/cifs/cifssmb.c +++ b/fs/cifs/cifssmb.c @@ -404,7 +404,7 @@ CIFSSMBNegotiate(unsigned int xid, struct cifsSesInfo *ses) pSMB->ByteCount = cpu_to_le16(count); rc = SendReceive(xid, ses, (struct smb_hdr *) pSMB, - (struct smb_hdr *) pSMBr, &bytes_returned, 0); + (struct smb_hdr *) pSMBr, &bytes_returned, 0, false); if (rc != 0) goto neg_err_exit; @@ -799,7 +799,7 @@ PsxDelete: pSMB->hdr.smb_buf_length += byte_count; pSMB->ByteCount = cpu_to_le16(byte_count); rc = SendReceive(xid, tcon->ses, (struct smb_hdr *) pSMB, - (struct smb_hdr *) pSMBr, &bytes_returned, 0); + (struct smb_hdr *) pSMBr, &bytes_returned, 0, tcon->retry); if (rc) cFYI(1, "Posix delete returned %d", rc); cifs_buf_release(pSMB); @@ -845,7 +845,7 @@ DelFileRetry: pSMB->hdr.smb_buf_length += name_len + 1; pSMB->ByteCount = cpu_to_le16(name_len + 1); rc = SendReceive(xid, tcon->ses, (struct smb_hdr *) pSMB, - (struct smb_hdr *) pSMBr, &bytes_returned, 0); + (struct smb_hdr *) pSMBr, &bytes_returned, 0, tcon->retry); cifs_stats_inc(&tcon->num_deletes); if (rc) cFYI(1, "Error in RMFile = %d", rc); @@ -889,7 +889,7 @@ RmDirRetry: pSMB->hdr.smb_buf_length += name_len + 1; pSMB->ByteCount = cpu_to_le16(name_len + 1); rc = SendReceive(xid, tcon->ses, (struct smb_hdr *) pSMB, - (struct smb_hdr *) pSMBr, &bytes_returned, 0); + (struct smb_hdr *) pSMBr, &bytes_returned, 0, tcon->retry); cifs_stats_inc(&tcon->num_rmdirs); if (rc) cFYI(1, "Error in RMDir = %d", rc); @@ -932,7 +932,7 @@ MkDirRetry: pSMB->hdr.smb_buf_length += name_len + 1; pSMB->ByteCount = cpu_to_le16(name_len + 1); rc = SendReceive(xid, tcon->ses, (struct smb_hdr *) pSMB, - (struct smb_hdr *) pSMBr, &bytes_returned, 0); + (struct smb_hdr *) pSMBr, &bytes_returned, 0, tcon->retry); cifs_stats_inc(&tcon->num_mkdirs); if (rc) cFYI(1, "Error in Mkdir = %d", rc); @@ -1010,7 +1010,7 @@ PsxCreat: pSMB->hdr.smb_buf_length += byte_count; pSMB->ByteCount = cpu_to_le16(byte_count); rc = SendReceive(xid, tcon->ses, (struct smb_hdr *) pSMB, - (struct smb_hdr *) pSMBr, &bytes_returned, 0); + (struct smb_hdr *) pSMBr, &bytes_returned, 0, tcon->retry); if (rc) { cFYI(1, "Posix create returned %d", rc); goto psx_create_err; @@ -1177,7 +1177,8 @@ OldOpenRetry: pSMB->ByteCount = cpu_to_le16(count); /* long_op set to 1 to allow for oplock break timeouts */ rc = SendReceive(xid, tcon->ses, (struct smb_hdr *) pSMB, - (struct smb_hdr *)pSMBr, &bytes_returned, CIFS_LONG_OP); + (struct smb_hdr *)pSMBr, &bytes_returned, CIFS_LONG_OP, + tcon->retry); cifs_stats_inc(&tcon->num_opens); if (rc) { cFYI(1, "Error in Open = %d", rc); @@ -1290,7 +1291,8 @@ openRetry: pSMB->ByteCount = cpu_to_le16(count); /* long_op set to 1 to allow for oplock break timeouts */ rc = SendReceive(xid, tcon->ses, (struct smb_hdr *) pSMB, - (struct smb_hdr *)pSMBr, &bytes_returned, CIFS_LONG_OP); + (struct smb_hdr *)pSMBr, &bytes_returned, CIFS_LONG_OP, + tcon->retry); cifs_stats_inc(&tcon->num_opens); if (rc) { cFYI(1, "Error in Open = %d", rc); @@ -1372,7 +1374,7 @@ CIFSSMBRead(const int xid, struct cifsTconInfo *tcon, const int netfid, iov[0].iov_base = (char *)pSMB; iov[0].iov_len = pSMB->hdr.smb_buf_length + 4; rc = SendReceive2(xid, tcon->ses, iov, 1 /* num iovecs */, - &resp_buf_type, CIFS_STD_OP | CIFS_LOG_ERROR); + &resp_buf_type, CIFS_STD_OP | CIFS_LOG_ERROR, tcon->retry); cifs_stats_inc(&tcon->num_reads); pSMBr = (READ_RSP *)iov[0].iov_base; if (rc) { @@ -1516,7 +1518,8 @@ CIFSSMBWrite(const int xid, struct cifsTconInfo *tcon, } rc = SendReceive(xid, tcon->ses, (struct smb_hdr *) pSMB, - (struct smb_hdr *) pSMBr, &bytes_returned, long_op); + (struct smb_hdr *) pSMBr, &bytes_returned, long_op, + tcon->retry); cifs_stats_inc(&tcon->num_writes); if (rc) { cFYI(1, "Send error in write = %d", rc); @@ -1608,7 +1611,7 @@ CIFSSMBWrite2(const int xid, struct cifsTconInfo *tcon, rc = SendReceive2(xid, tcon->ses, iov, n_vec + 1, &resp_buf_type, - long_op); + long_op, tcon->retry); cifs_stats_inc(&tcon->num_writes); if (rc) { cFYI(1, "Send error Write2 = %d", rc); @@ -1790,7 +1793,7 @@ CIFSSMBPosixLock(const int xid, struct cifsTconInfo *tcon, iov[0].iov_base = (char *)pSMB; iov[0].iov_len = pSMB->hdr.smb_buf_length + 4; rc = SendReceive2(xid, tcon->ses, iov, 1 /* num iovecs */, - &resp_buf_type, timeout); + &resp_buf_type, timeout, false); pSMB = NULL; /* request buf already freed by SendReceive2. Do not try to free it twice below on exit */ pSMBr = (struct smb_com_transaction2_sfi_rsp *)iov[0].iov_base; @@ -1958,7 +1961,7 @@ renameRetry: pSMB->ByteCount = cpu_to_le16(count); rc = SendReceive(xid, tcon->ses, (struct smb_hdr *) pSMB, - (struct smb_hdr *) pSMBr, &bytes_returned, 0); + (struct smb_hdr *) pSMBr, &bytes_returned, 0, tcon->retry); cifs_stats_inc(&tcon->num_renames); if (rc) cFYI(1, "Send error in rename = %d", rc); @@ -2037,7 +2040,7 @@ int CIFSSMBRenameOpenFile(const int xid, struct cifsTconInfo *pTcon, pSMB->hdr.smb_buf_length += byte_count; pSMB->ByteCount = cpu_to_le16(byte_count); rc = SendReceive(xid, pTcon->ses, (struct smb_hdr *) pSMB, - (struct smb_hdr *) pSMBr, &bytes_returned, 0); + (struct smb_hdr *) pSMBr, &bytes_returned, 0, pTcon->retry); cifs_stats_inc(&pTcon->num_t2renames); if (rc) cFYI(1, "Send error in Rename (by file handle) = %d", rc); @@ -2105,7 +2108,7 @@ copyRetry: pSMB->ByteCount = cpu_to_le16(count); rc = SendReceive(xid, tcon->ses, (struct smb_hdr *) pSMB, - (struct smb_hdr *) pSMBr, &bytes_returned, 0); + (struct smb_hdr *) pSMBr, &bytes_returned, 0, tcon->retry); if (rc) { cFYI(1, "Send error in copy = %d with %d files copied", rc, le16_to_cpu(pSMBr->CopyCount)); @@ -2194,7 +2197,7 @@ createSymLinkRetry: pSMB->hdr.smb_buf_length += byte_count; pSMB->ByteCount = cpu_to_le16(byte_count); rc = SendReceive(xid, tcon->ses, (struct smb_hdr *) pSMB, - (struct smb_hdr *) pSMBr, &bytes_returned, 0); + (struct smb_hdr *) pSMBr, &bytes_returned, 0, tcon->retry); cifs_stats_inc(&tcon->num_symlinks); if (rc) cFYI(1, "Send error in SetPathInfo create symlink = %d", rc); @@ -2280,7 +2283,7 @@ createHardLinkRetry: pSMB->hdr.smb_buf_length += byte_count; pSMB->ByteCount = cpu_to_le16(byte_count); rc = SendReceive(xid, tcon->ses, (struct smb_hdr *) pSMB, - (struct smb_hdr *) pSMBr, &bytes_returned, 0); + (struct smb_hdr *) pSMBr, &bytes_returned, 0, tcon->retry); cifs_stats_inc(&tcon->num_hardlinks); if (rc) cFYI(1, "Send error in SetPathInfo (hard link) = %d", rc); @@ -2352,7 +2355,7 @@ winCreateHardLinkRetry: pSMB->ByteCount = cpu_to_le16(count); rc = SendReceive(xid, tcon->ses, (struct smb_hdr *) pSMB, - (struct smb_hdr *) pSMBr, &bytes_returned, 0); + (struct smb_hdr *) pSMBr, &bytes_returned, 0, tcon->retry); cifs_stats_inc(&tcon->num_hardlinks); if (rc) cFYI(1, "Send error in hard link (NT rename) = %d", rc); @@ -2423,7 +2426,7 @@ querySymLinkRetry: pSMB->ByteCount = cpu_to_le16(byte_count); rc = SendReceive(xid, tcon->ses, (struct smb_hdr *) pSMB, - (struct smb_hdr *) pSMBr, &bytes_returned, 0); + (struct smb_hdr *) pSMBr, &bytes_returned, 0, tcon->retry); if (rc) { cFYI(1, "Send error in QuerySymLinkInfo = %d", rc); } else { @@ -2586,7 +2589,7 @@ CIFSSMBQueryReparseLinkInfo(const int xid, struct cifsTconInfo *tcon, pSMB->ByteCount = 0; rc = SendReceive(xid, tcon->ses, (struct smb_hdr *) pSMB, - (struct smb_hdr *) pSMBr, &bytes_returned, 0); + (struct smb_hdr *) pSMBr, &bytes_returned, 0, tcon->retry); if (rc) { cFYI(1, "Send error in QueryReparseLinkInfo = %d", rc); } else { /* decode response */ @@ -2849,7 +2852,7 @@ queryAclRetry: pSMB->ByteCount = cpu_to_le16(byte_count); rc = SendReceive(xid, tcon->ses, (struct smb_hdr *) pSMB, - (struct smb_hdr *) pSMBr, &bytes_returned, 0); + (struct smb_hdr *) pSMBr, &bytes_returned, 0, tcon->retry); cifs_stats_inc(&tcon->num_acl_get); if (rc) { cFYI(1, "Send error in Query POSIX ACL = %d", rc); @@ -2942,7 +2945,7 @@ setAclRetry: pSMB->hdr.smb_buf_length += byte_count; pSMB->ByteCount = cpu_to_le16(byte_count); rc = SendReceive(xid, tcon->ses, (struct smb_hdr *) pSMB, - (struct smb_hdr *) pSMBr, &bytes_returned, 0); + (struct smb_hdr *) pSMBr, &bytes_returned, 0, tcon->retry); if (rc) cFYI(1, "Set POSIX ACL returned %d", rc); @@ -3001,7 +3004,7 @@ GetExtAttrRetry: pSMB->t2.ByteCount = cpu_to_le16(byte_count); rc = SendReceive(xid, tcon->ses, (struct smb_hdr *) pSMB, - (struct smb_hdr *) pSMBr, &bytes_returned, 0); + (struct smb_hdr *) pSMBr, &bytes_returned, 0, tcon->retry); if (rc) { cFYI(1, "error %d in GetExtAttr", rc); } else { @@ -3070,7 +3073,7 @@ CIFSSMBGetCIFSACL(const int xid, struct cifsTconInfo *tcon, __u16 fid, iov[0].iov_len = pSMB->hdr.smb_buf_length + 4; rc = SendReceive2(xid, tcon->ses, iov, 1 /* num iovec */, &buf_type, - CIFS_STD_OP); + CIFS_STD_OP, tcon->retry); cifs_stats_inc(&tcon->num_acl_get); if (rc) { cFYI(1, "Send error in QuerySecDesc = %d", rc); @@ -3182,7 +3185,7 @@ setCifsAclRetry: pSMB->hdr.smb_buf_length += byte_count; rc = SendReceive(xid, tcon->ses, (struct smb_hdr *) pSMB, - (struct smb_hdr *) pSMBr, &bytes_returned, 0); + (struct smb_hdr *) pSMBr, &bytes_returned, 0, tcon->retry); cFYI(1, "SetCIFSACL bytes_returned: %d, rc: %d", bytes_returned, rc); if (rc) @@ -3234,7 +3237,7 @@ QInfRetry: pSMB->ByteCount = cpu_to_le16(name_len); rc = SendReceive(xid, tcon->ses, (struct smb_hdr *) pSMB, - (struct smb_hdr *) pSMBr, &bytes_returned, 0); + (struct smb_hdr *) pSMBr, &bytes_returned, 0, tcon->retry); if (rc) { cFYI(1, "Send error in QueryInfo = %d", rc); } else if (pFinfo) { @@ -3308,7 +3311,7 @@ QFileInfoRetry: pSMB->hdr.smb_buf_length += byte_count; rc = SendReceive(xid, tcon->ses, (struct smb_hdr *) pSMB, - (struct smb_hdr *) pSMBr, &bytes_returned, 0); + (struct smb_hdr *) pSMBr, &bytes_returned, 0, tcon->retry); if (rc) { cFYI(1, "Send error in QPathInfo = %d", rc); } else { /* decode response */ @@ -3396,7 +3399,7 @@ QPathInfoRetry: pSMB->ByteCount = cpu_to_le16(byte_count); rc = SendReceive(xid, tcon->ses, (struct smb_hdr *) pSMB, - (struct smb_hdr *) pSMBr, &bytes_returned, 0); + (struct smb_hdr *) pSMBr, &bytes_returned, 0, tcon->retry); if (rc) { cFYI(1, "Send error in QPathInfo = %d", rc); } else { /* decode response */ @@ -3476,7 +3479,7 @@ UnixQFileInfoRetry: pSMB->hdr.smb_buf_length += byte_count; rc = SendReceive(xid, tcon->ses, (struct smb_hdr *) pSMB, - (struct smb_hdr *) pSMBr, &bytes_returned, 0); + (struct smb_hdr *) pSMBr, &bytes_returned, 0, tcon->retry); if (rc) { cFYI(1, "Send error in QPathInfo = %d", rc); } else { /* decode response */ @@ -3562,7 +3565,7 @@ UnixQPathInfoRetry: pSMB->ByteCount = cpu_to_le16(byte_count); rc = SendReceive(xid, tcon->ses, (struct smb_hdr *) pSMB, - (struct smb_hdr *) pSMBr, &bytes_returned, 0); + (struct smb_hdr *) pSMBr, &bytes_returned, 0, tcon->retry); if (rc) { cFYI(1, "Send error in QPathInfo = %d", rc); } else { /* decode response */ @@ -3676,7 +3679,7 @@ findFirstRetry: pSMB->ByteCount = cpu_to_le16(byte_count); rc = SendReceive(xid, tcon->ses, (struct smb_hdr *) pSMB, - (struct smb_hdr *) pSMBr, &bytes_returned, 0); + (struct smb_hdr *) pSMBr, &bytes_returned, 0, tcon->retry); cifs_stats_inc(&tcon->num_ffirst); if (rc) {/* BB add logic to retry regular search if Unix search @@ -3805,7 +3808,7 @@ int CIFSFindNext(const int xid, struct cifsTconInfo *tcon, pSMB->ByteCount = cpu_to_le16(byte_count); rc = SendReceive(xid, tcon->ses, (struct smb_hdr *) pSMB, - (struct smb_hdr *) pSMBr, &bytes_returned, 0); + (struct smb_hdr *) pSMBr, &bytes_returned, 0, tcon->retry); cifs_stats_inc(&tcon->num_fnext); if (rc) { if (rc == -EBADF) { @@ -3967,7 +3970,7 @@ GetInodeNumberRetry: pSMB->ByteCount = cpu_to_le16(byte_count); rc = SendReceive(xid, tcon->ses, (struct smb_hdr *) pSMB, - (struct smb_hdr *) pSMBr, &bytes_returned, 0); + (struct smb_hdr *) pSMBr, &bytes_returned, 0, tcon->retry); if (rc) { cFYI(1, "error %d in QueryInternalInfo", rc); } else { @@ -4191,7 +4194,7 @@ getDFSRetry: pSMB->ByteCount = cpu_to_le16(byte_count); rc = SendReceive(xid, ses, (struct smb_hdr *) pSMB, - (struct smb_hdr *) pSMBr, &bytes_returned, 0); + (struct smb_hdr *) pSMBr, &bytes_returned, 0, false); if (rc) { cFYI(1, "Send error in GetDFSRefer = %d", rc); goto GetDFSRefExit; @@ -4265,7 +4268,7 @@ oldQFSInfoRetry: pSMB->ByteCount = cpu_to_le16(byte_count); rc = SendReceive(xid, tcon->ses, (struct smb_hdr *) pSMB, - (struct smb_hdr *) pSMBr, &bytes_returned, 0); + (struct smb_hdr *) pSMBr, &bytes_returned, 0, tcon->retry); if (rc) { cFYI(1, "Send error in QFSInfo = %d", rc); } else { /* decode response */ @@ -4344,7 +4347,7 @@ QFSInfoRetry: pSMB->ByteCount = cpu_to_le16(byte_count); rc = SendReceive(xid, tcon->ses, (struct smb_hdr *) pSMB, - (struct smb_hdr *) pSMBr, &bytes_returned, 0); + (struct smb_hdr *) pSMBr, &bytes_returned, 0, tcon->retry); if (rc) { cFYI(1, "Send error in QFSInfo = %d", rc); } else { /* decode response */ @@ -4424,7 +4427,7 @@ QFSAttributeRetry: pSMB->ByteCount = cpu_to_le16(byte_count); rc = SendReceive(xid, tcon->ses, (struct smb_hdr *) pSMB, - (struct smb_hdr *) pSMBr, &bytes_returned, 0); + (struct smb_hdr *) pSMBr, &bytes_returned, 0, tcon->retry); if (rc) { cERROR(1, "Send error in QFSAttributeInfo = %d", rc); } else { /* decode response */ @@ -4495,7 +4498,7 @@ QFSDeviceRetry: pSMB->ByteCount = cpu_to_le16(byte_count); rc = SendReceive(xid, tcon->ses, (struct smb_hdr *) pSMB, - (struct smb_hdr *) pSMBr, &bytes_returned, 0); + (struct smb_hdr *) pSMBr, &bytes_returned, 0, tcon->retry); if (rc) { cFYI(1, "Send error in QFSDeviceInfo = %d", rc); } else { /* decode response */ @@ -4564,7 +4567,7 @@ QFSUnixRetry: pSMB->ByteCount = cpu_to_le16(byte_count); rc = SendReceive(xid, tcon->ses, (struct smb_hdr *) pSMB, - (struct smb_hdr *) pSMBr, &bytes_returned, 0); + (struct smb_hdr *) pSMBr, &bytes_returned, 0, tcon->retry); if (rc) { cERROR(1, "Send error in QFSUnixInfo = %d", rc); } else { /* decode response */ @@ -4647,7 +4650,7 @@ SETFSUnixRetry: pSMB->ByteCount = cpu_to_le16(byte_count); rc = SendReceive(xid, tcon->ses, (struct smb_hdr *) pSMB, - (struct smb_hdr *) pSMBr, &bytes_returned, 0); + (struct smb_hdr *) pSMBr, &bytes_returned, 0, tcon->retry); if (rc) { cERROR(1, "Send error in SETFSUnixInfo = %d", rc); } else { /* decode response */ @@ -4709,7 +4712,7 @@ QFSPosixRetry: pSMB->ByteCount = cpu_to_le16(byte_count); rc = SendReceive(xid, tcon->ses, (struct smb_hdr *) pSMB, - (struct smb_hdr *) pSMBr, &bytes_returned, 0); + (struct smb_hdr *) pSMBr, &bytes_returned, 0, tcon->retry); if (rc) { cFYI(1, "Send error in QFSUnixInfo = %d", rc); } else { /* decode response */ @@ -4835,7 +4838,7 @@ SetEOFRetry: parm_data->FileSize = cpu_to_le64(size); pSMB->ByteCount = cpu_to_le16(byte_count); rc = SendReceive(xid, tcon->ses, (struct smb_hdr *) pSMB, - (struct smb_hdr *) pSMBr, &bytes_returned, 0); + (struct smb_hdr *) pSMBr, &bytes_returned, 0, tcon->retry); if (rc) cFYI(1, "SetPathInfo (file size) returned %d", rc); @@ -5117,7 +5120,7 @@ SetTimesRetry: memcpy(data_offset, data, sizeof(FILE_BASIC_INFO)); pSMB->ByteCount = cpu_to_le16(byte_count); rc = SendReceive(xid, tcon->ses, (struct smb_hdr *) pSMB, - (struct smb_hdr *) pSMBr, &bytes_returned, 0); + (struct smb_hdr *) pSMBr, &bytes_returned, 0, tcon->retry); if (rc) cFYI(1, "SetPathInfo (times) returned %d", rc); @@ -5352,7 +5355,7 @@ setPermsRetry: pSMB->ByteCount = cpu_to_le16(byte_count); rc = SendReceive(xid, tcon->ses, (struct smb_hdr *) pSMB, - (struct smb_hdr *) pSMBr, &bytes_returned, 0); + (struct smb_hdr *) pSMBr, &bytes_returned, 0, tcon->retry); if (rc) cFYI(1, "SetPathInfo (perms) returned %d", rc); @@ -5404,8 +5407,8 @@ int CIFSSMBNotify(const int xid, struct cifsTconInfo *tcon, pSMB->ByteCount = 0; rc = SendReceive(xid, tcon->ses, (struct smb_hdr *) pSMB, - (struct smb_hdr *)pSMBr, &bytes_returned, - CIFS_ASYNC_OP); + (struct smb_hdr *)pSMBr, &bytes_returned, CIFS_ASYNC_OP, + tcon->retry); if (rc) { cFYI(1, "Error in Notify = %d", rc); } else { @@ -5508,7 +5511,7 @@ QAllEAsRetry: pSMB->ByteCount = cpu_to_le16(byte_count); rc = SendReceive(xid, tcon->ses, (struct smb_hdr *) pSMB, - (struct smb_hdr *) pSMBr, &bytes_returned, 0); + (struct smb_hdr *) pSMBr, &bytes_returned, 0, tcon->retry); if (rc) { cFYI(1, "Send error in QueryAllEAs = %d", rc); goto QAllEAsOut; @@ -5720,7 +5723,7 @@ SetEARetry: pSMB->hdr.smb_buf_length += byte_count; pSMB->ByteCount = cpu_to_le16(byte_count); rc = SendReceive(xid, tcon->ses, (struct smb_hdr *) pSMB, - (struct smb_hdr *) pSMBr, &bytes_returned, 0); + (struct smb_hdr *) pSMBr, &bytes_returned, 0, tcon->retry); if (rc) cFYI(1, "SetPathInfo (EA) returned %d", rc); diff --git a/fs/cifs/connect.c b/fs/cifs/connect.c index 2208f06..7ddc602 100644 --- a/fs/cifs/connect.c +++ b/fs/cifs/connect.c @@ -1809,6 +1809,9 @@ cifs_get_tcon(struct cifsSesInfo *ses, struct smb_vol *volume_info) } } + if (volume_info->retry) + tcon->retry = volume_info->retry; + if (strchr(volume_info->UNC + 3, '\\') == NULL && strchr(volume_info->UNC + 3, '/') == NULL) { cERROR(1, "Missing share name"); @@ -2807,7 +2810,7 @@ CIFSTCon(unsigned int xid, struct cifsSesInfo *ses, pSMB->ByteCount = cpu_to_le16(count); rc = SendReceive(xid, ses, smb_buffer, smb_buffer_response, &length, - CIFS_STD_OP); + CIFS_STD_OP, false); /* above now done in SendReceive */ if ((rc == 0) && (tcon != NULL)) { diff --git a/fs/cifs/sess.c b/fs/cifs/sess.c index 7707389..ff0dfb7 100644 --- a/fs/cifs/sess.c +++ b/fs/cifs/sess.c @@ -866,7 +866,7 @@ ssetup_ntlmssp_authenticate: BCC_LE(smb_buf) = cpu_to_le16(count); rc = SendReceive2(xid, ses, iov, 3 /* num_iovecs */, &resp_buf_type, - CIFS_STD_OP /* not long */ | CIFS_LOG_ERROR); + CIFS_STD_OP /* not long */ | CIFS_LOG_ERROR, false); /* SMB request buf freed in SendReceive2 */ cFYI(1, "ssetup rc from sendrecv2 is %d", rc); diff --git a/fs/cifs/transport.c b/fs/cifs/transport.c index 82f78c4..6df667d 100644 --- a/fs/cifs/transport.c +++ b/fs/cifs/transport.c @@ -311,6 +311,44 @@ static int allocate_mid(struct cifsSesInfo *ses, struct smb_hdr *in_buf, return 0; } +static int +wait_for_response_hard(struct cifsSesInfo *ses, struct mid_q_entry *midQ) +{ + int rc; + bool cmdresp = true; + unsigned long timeout = 60 * HZ; + unsigned long curr_timeout; + +wait_again: + curr_timeout = timeout + jiffies; + rc = wait_event_interruptible_timeout(ses->server->response_q, + (midQ->midState != MID_REQUEST_SUBMITTED), timeout); + + if (rc < 0) { + cFYI(1, "command 0x%x interrupted", midQ->command); + return -1; + } + if (!time_before(jiffies, curr_timeout)) { + cmdresp = false; + cFYI(1, "server not responding..."); + goto wait_again; + } + spin_lock(&GlobalMid_Lock); + if (midQ->midState != MID_REQUEST_SUBMITTED) { + if (midQ->midState == MID_RESPONSE_RECEIVED) { + if (!cmdresp) + cFYI(1, "server is ok..."); + rc = 0; + } else { + cFYI(1, "command 0x%x aborted", midQ->command); + rc = -1; + } + } + spin_unlock(&GlobalMid_Lock); + return rc; +} + + static int wait_for_response(struct cifsSesInfo *ses, struct mid_q_entry *midQ, unsigned long timeout, @@ -376,7 +414,7 @@ SendReceiveNoRsp(const unsigned int xid, struct cifsSesInfo *ses, iov[0].iov_base = (char *)in_buf; iov[0].iov_len = in_buf->smb_buf_length + 4; flags |= CIFS_NO_RESP; - rc = SendReceive2(xid, ses, iov, 1, &resp_buf_type, flags); + rc = SendReceive2(xid, ses, iov, 1, &resp_buf_type, flags, false); cFYI(DBG2, "SendRcvNoRsp flags %d rc %d", flags, rc); return rc; @@ -385,7 +423,7 @@ SendReceiveNoRsp(const unsigned int xid, struct cifsSesInfo *ses, int SendReceive2(const unsigned int xid, struct cifsSesInfo *ses, struct kvec *iov, int n_vec, int *pRespBufType /* ret */, - const int flags) + const int flags, bool hard_mount) { int rc = 0; int long_op; @@ -483,7 +521,10 @@ SendReceive2(const unsigned int xid, struct cifsSesInfo *ses, } /* No user interrupts in wait - wreaks havoc with performance */ - wait_for_response(ses, midQ, timeout, 10 * HZ); + if (hard_mount) + wait_for_response_hard(ses, midQ); + else + wait_for_response(ses, midQ, timeout, 10 * HZ); spin_lock(&GlobalMid_Lock); @@ -581,7 +622,7 @@ out: int SendReceive(const unsigned int xid, struct cifsSesInfo *ses, struct smb_hdr *in_buf, struct smb_hdr *out_buf, - int *pbytes_returned, const int long_op) + int *pbytes_returned, const int long_op, bool hard_mount) { int rc = 0; unsigned int receive_len; @@ -675,7 +716,10 @@ SendReceive(const unsigned int xid, struct cifsSesInfo *ses, } /* No user interrupts in wait - wreaks havoc with performance */ - wait_for_response(ses, midQ, timeout, 10 * HZ); + if (hard_mount) + wait_for_response_hard(ses, midQ); + else + wait_for_response(ses, midQ, timeout, 10 * HZ); spin_lock(&GlobalMid_Lock); if (midQ->resp_buf == NULL) { @@ -807,7 +851,7 @@ send_lock_cancel(const unsigned int xid, struct cifsTconInfo *tcon, pSMB->hdr.Mid = GetNextMid(ses->server); return SendReceive(xid, ses, in_buf, out_buf, - &bytes_returned, CIFS_STD_OP); + &bytes_returned, CIFS_STD_OP, tcon->retry); } int