All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 2/4] 4.1 client: support op_cb_layoutrecall
@ 2015-07-28 11:46 Kinglong Mee
  0 siblings, 0 replies; only message in thread
From: Kinglong Mee @ 2015-07-28 11:46 UTC (permalink / raw)
  To: J. Bruce Fields, linux-nfs@vger.kernel.org; +Cc: tigran.mkrtchyan, kinglongmee

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


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2015-07-28 11:46 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-07-28 11:46 [PATCH 2/4] 4.1 client: support op_cb_layoutrecall Kinglong Mee

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.