All of lore.kernel.org
 help / color / mirror / Atom feed
From: Kinglong Mee <kinglongmee@gmail.com>
To: "J. Bruce Fields" <bfields@fieldses.org>,
	"linux-nfs@vger.kernel.org" <linux-nfs@vger.kernel.org>
Cc: tigran.mkrtchyan@desy.de, kinglongmee@gmail.com
Subject: [PATCH 2/4] 4.1 client: support op_cb_layoutrecall
Date: Tue, 28 Jul 2015 19:46:31 +0800	[thread overview]
Message-ID: <55B76B97.7050703@gmail.com> (raw)

Signed-off-by: Kinglong Mee <kinglongmee@gmail.com>
---
 nfs4.1/nfs4client.py | 26 ++++++++++++++++++++++++++
 1 file changed, 26 insertions(+)

diff --git a/nfs4.1/nfs4client.py b/nfs4.1/nfs4client.py
index 14b34d2..5f1db9e 100644
--- a/nfs4.1/nfs4client.py
+++ b/nfs4.1/nfs4client.py
@@ -6,6 +6,7 @@ from xdrdef.nfs4_type import *
 from xdrdef.nfs4_const import *
 from xdrdef.sctrl_pack import SCTRLPacker, SCTRLUnpacker
 import nfs_ops
+op = nfs_ops.NFS4ops()
 import time, struct
 import threading
 import hmac
@@ -274,6 +275,31 @@ class NFS4Client(rpc.Client, rpc.Server):
         res = self.posthook(arg, env, res=NFS4_OK)
         return encode_status(res)
 
+    def op_cb_layoutrecall(self, arg, env):
+        log_cb.info("In CB_LAYOUTRECALL")
+        self.prehook(arg, env)
+        res = self.posthook(arg, env, res=NFS4_OK)
+        if res is not NFS4_OK:
+            return encode_status(res)
+
+        op_lorecall = arg.opcblayoutrecall
+        lo_type = op_lorecall.clora_type
+        lo_iomode = op_lorecall.clora_iomode
+        lo_recall = op_lorecall.clora_recall
+        lo_recalltype = lo_recall.lor_recalltype
+        if lo_recalltype is LAYOUTRECALL4_FILE:
+            rclayout = lo_recall.lor_layout
+            ops = [op.putfh(rclayout.lor_fh),
+                   op.layoutreturn(False, lo_type, lo_iomode,
+                      layoutreturn4(LAYOUTRETURN4_FILE,
+                                    layoutreturn_file4(rclayout.lor_offset,
+                                                       rclayout.lor_length, \
+                                                       rclayout.lor_stateid, "")))]
+            env.session.compound(ops)
+        elif lo_recalltype not in [LAYOUTRECALL4_FSID, LAYOUTRECALL4_ALL]:
+            res = NFS4ERR_NOTSUPP
+        return encode_status(res)
+
     def new_client(self, name, verf=None, cred=None, protect=None, flags=0,
                    expect=NFS4_OK):
         """Establish a new client_id with the server"""
-- 
2.4.3


                 reply	other threads:[~2015-07-28 11:46 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=55B76B97.7050703@gmail.com \
    --to=kinglongmee@gmail.com \
    --cc=bfields@fieldses.org \
    --cc=linux-nfs@vger.kernel.org \
    --cc=tigran.mkrtchyan@desy.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.