[PATCH 2/4] 4.1 client: support op_cb_layoutrecall

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Signed-off-by: Kinglong Mee <kinglongmee@xxxxxxxxx>
---
 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

--
To unsubscribe from this list: send the line "unsubscribe linux-nfs" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux Filesystem Development]     [Linux USB Development]     [Linux Media Development]     [Video for Linux]     [Linux NILFS]     [Linux Audio Users]     [Yosemite Info]     [Linux SCSI]

  Powered by Linux