From patchwork Wed Jul 18 15:48:58 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pavel Shilovsky X-Patchwork-Id: 1212311 Return-Path: X-Original-To: patchwork-cifs-client@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork1.kernel.org (Postfix) with ESMTP id 7EF4E3FD4F for ; Wed, 18 Jul 2012 15:51:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754817Ab2GRPvb (ORCPT ); Wed, 18 Jul 2012 11:51:31 -0400 Received: from mail-lb0-f174.google.com ([209.85.217.174]:57672 "EHLO mail-lb0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754761Ab2GRPva (ORCPT ); Wed, 18 Jul 2012 11:51:30 -0400 Received: by mail-lb0-f174.google.com with SMTP id gm6so2257593lbb.19 for ; Wed, 18 Jul 2012 08:51:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:from:to:subject:date:message-id:x-mailer:in-reply-to :references; bh=WUPjLkz9AcKyyR8acfjdFJg4S1i7Lou1gO9feP5uBIQ=; b=AL9WenRN2GCczItTkGyfYESadbX+Bnbo6cpxvR8TGm8tDy7zMVngI0owxX+WM3cJzM AceKn7VZezmXph92AeWwxsYQ2A0gzild6zDR2uHvilJvVtIxEJm1sC+tCidnfrrrykc2 UntZVb3fQ+JkZ8aIW3+tYSzG/2nUGgppWAnf7crgW1OvIPHV9DocrLH8gGqCNaKDI6Ew 0RblnCU+YjEQAbDtijrr5HD28h4cuWshuVbe4AAGJkrNDCkJRO2edYqRAlKmK/QpnGYM 9fqX3VlBBUkY/HgZ/b9SEl00cjbVI1gzAyPVJbpaWmMQ9+wcF1cIdQTxUm3t1/lC/esP XV7g== Received: by 10.112.30.41 with SMTP id p9mr2132425lbh.26.1342626690003; Wed, 18 Jul 2012 08:51:30 -0700 (PDT) Received: from localhost.localdomain ([178.45.208.11]) by mx.google.com with ESMTPS id p2sm4826985lbj.4.2012.07.18.08.51.28 (version=TLSv1/SSLv3 cipher=OTHER); Wed, 18 Jul 2012 08:51:29 -0700 (PDT) From: Pavel Shilovsky To: linux-cifs@vger.kernel.org Subject: [PATCH 42/45] CIFS: Move oplock break to ops struct Date: Wed, 18 Jul 2012 19:48:58 +0400 Message-Id: <1342626541-29872-43-git-send-email-pshilovsky@samba.org> X-Mailer: git-send-email 1.7.1 In-Reply-To: <1342626541-29872-1-git-send-email-pshilovsky@samba.org> References: <1342626541-29872-1-git-send-email-pshilovsky@samba.org> Sender: linux-cifs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-cifs@vger.kernel.org Signed-off-by: Pavel Shilovsky --- fs/cifs/cifsglob.h | 4 ++++ fs/cifs/file.c | 7 +++---- fs/cifs/smb1ops.c | 10 ++++++++++ 3 files changed, 17 insertions(+), 4 deletions(-) diff --git a/fs/cifs/cifsglob.h b/fs/cifs/cifsglob.h index 133cd0c..a8f424f 100644 --- a/fs/cifs/cifsglob.h +++ b/fs/cifs/cifsglob.h @@ -178,6 +178,7 @@ struct cifs_readdata; struct cifs_writedata; struct cifs_io_parms; struct cifs_search_info; +struct cifsInodeInfo; struct smb_version_operations { int (*send_cancel)(struct TCP_Server_Info *, void *, @@ -329,6 +330,9 @@ struct smb_version_operations { /* calculate a size of SMB message */ unsigned int (*calc_smb_size)(void *); bool (*is_status_pending)(char *, struct TCP_Server_Info *, int); + /* send oplock break response */ + int (*oplock_response)(struct cifs_tcon *, struct cifs_fid *, + struct cifsInodeInfo *); }; struct smb_version_values { diff --git a/fs/cifs/file.c b/fs/cifs/file.c index da9dc50..40230a7 100644 --- a/fs/cifs/file.c +++ b/fs/cifs/file.c @@ -3395,6 +3395,7 @@ void cifs_oplock_break(struct work_struct *work) oplock_break); struct inode *inode = cfile->dentry->d_inode; struct cifsInodeInfo *cinode = CIFS_I(inode); + struct cifs_tcon *tcon = tlink_tcon(cfile->tlink); int rc = 0; if (inode && S_ISREG(inode->i_mode)) { @@ -3422,10 +3423,8 @@ void cifs_oplock_break(struct work_struct *work) * disconnected since oplock already released by the server */ if (!cfile->oplock_break_cancelled) { - rc = CIFSSMBLock(0, tlink_tcon(cfile->tlink), cfile->fid.netfid, - current->tgid, 0, 0, 0, 0, - LOCKING_ANDX_OPLOCK_RELEASE, false, - cinode->clientCanCacheRead ? 1 : 0); + rc = tcon->ses->server->ops->oplock_response(tcon, &cfile->fid, + cinode); cFYI(1, "Oplock release rc = %d", rc); } } diff --git a/fs/cifs/smb1ops.c b/fs/cifs/smb1ops.c index 068d609..f55b2e3 100644 --- a/fs/cifs/smb1ops.c +++ b/fs/cifs/smb1ops.c @@ -863,6 +863,15 @@ cifs_close_dir(const unsigned int xid, struct cifs_tcon *tcon, return CIFSFindClose(xid, tcon, fid->netfid); } +static int +cifs_oplock_response(struct cifs_tcon *tcon, struct cifs_fid *fid, + struct cifsInodeInfo *cinode) +{ + return CIFSSMBLock(0, tcon, fid->netfid, current->tgid, 0, 0, 0, 0, + LOCKING_ANDX_OPLOCK_RELEASE, false, + cinode->clientCanCacheRead ? 1 : 0); +} + struct smb_version_operations smb1_operations = { .send_cancel = send_nt_cancel, .compare_fids = cifs_compare_fids, @@ -922,6 +931,7 @@ struct smb_version_operations smb1_operations = { .query_dir_next = cifs_query_dir_next, .close_dir = cifs_close_dir, .calc_smb_size = smbCalcSize, + .oplock_response = cifs_oplock_response, }; struct smb_version_values smb1_values = {