summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--libglusterfs/src/call-stub.c140
-rw-r--r--libglusterfs/src/call-stub.h47
-rw-r--r--libglusterfs/src/common-utils.c2
-rw-r--r--libglusterfs/src/defaults.c45
-rw-r--r--libglusterfs/src/defaults.h9
-rw-r--r--libglusterfs/src/glusterfs.h2
-rw-r--r--libglusterfs/src/protocol.h14
-rw-r--r--libglusterfs/src/xlator.c4
-rw-r--r--libglusterfs/src/xlator.h26
9 files changed, 287 insertions, 2 deletions
diff --git a/libglusterfs/src/call-stub.c b/libglusterfs/src/call-stub.c
index cd7357259..76f0a736a 100644
--- a/libglusterfs/src/call-stub.c
+++ b/libglusterfs/src/call-stub.c
@@ -2062,6 +2062,91 @@ fop_fxattrop_stub (call_frame_t *frame,
}
+call_stub_t *
+fop_lock_notify_cbk_stub (call_frame_t *frame, fop_lock_notify_cbk_t fn,
+ int32_t op_ret, int32_t op_errno)
+{
+ call_stub_t *stub = NULL;
+
+ GF_VALIDATE_OR_GOTO ("call-stub", frame, out);
+
+ stub = stub_new (frame, 0, GF_FOP_LOCK_NOTIFY);
+ GF_VALIDATE_OR_GOTO ("call-stub", stub, out);
+
+ stub->args.lock_notify_cbk.fn = fn;
+ stub->args.lock_notify_cbk.op_ret = op_ret;
+ stub->args.lock_notify_cbk.op_errno = op_errno;
+
+out:
+ return stub;
+}
+
+
+call_stub_t *
+fop_lock_notify_stub (call_frame_t *frame, fop_lock_notify_t fn,
+ loc_t *loc, int32_t timeout)
+{
+ call_stub_t *stub = NULL;
+
+ if (!frame)
+ return NULL;
+
+ stub = stub_new (frame, 1, GF_FOP_LOCK_NOTIFY);
+ if (!stub)
+ return NULL;
+
+ stub->args.lock_notify.fn = fn;
+
+ loc_copy (&stub->args.lock_notify.loc, loc);
+
+ stub->args.lock_notify.timeout = timeout;
+
+ return stub;
+}
+
+
+call_stub_t *
+fop_lock_fnotify_cbk_stub (call_frame_t *frame, fop_lock_fnotify_cbk_t fn,
+ int32_t op_ret, int32_t op_errno)
+{
+ call_stub_t *stub = NULL;
+
+ GF_VALIDATE_OR_GOTO ("call-stub", frame, out);
+
+ stub = stub_new (frame, 0, GF_FOP_LOCK_FNOTIFY);
+ GF_VALIDATE_OR_GOTO ("call-stub", stub, out);
+
+ stub->args.lock_fnotify_cbk.fn = fn;
+ stub->args.lock_fnotify_cbk.op_ret = op_ret;
+ stub->args.lock_fnotify_cbk.op_errno = op_errno;
+
+out:
+ return stub;
+}
+
+
+call_stub_t *
+fop_lock_fnotify_stub (call_frame_t *frame, fop_lock_fnotify_t fn,
+ fd_t *fd, int32_t timeout)
+{
+ call_stub_t *stub = NULL;
+
+ if (!frame)
+ return NULL;
+
+ stub = stub_new (frame, 1, GF_FOP_LOCK_FNOTIFY);
+ if (!stub)
+ return NULL;
+
+ stub->args.lock_fnotify.fn = fn;
+
+ stub->args.lock_fnotify.fd = fd_ref (fd);
+ stub->args.lock_fnotify.timeout = timeout;
+
+ return stub;
+}
+
+
static void
call_resume_wind (call_stub_t *stub)
{
@@ -2458,6 +2543,22 @@ call_resume_wind (call_stub_t *stub)
break;
}
+ case GF_FOP_LOCK_NOTIFY:
+ {
+ stub->args.lock_notify.fn (stub->frame,
+ stub->frame->this,
+ &stub->args.lock_notify.loc,
+ stub->args.lock_notify.timeout);
+ break;
+ }
+ case GF_FOP_LOCK_FNOTIFY:
+ {
+ stub->args.lock_fnotify.fn (stub->frame,
+ stub->frame->this,
+ stub->args.lock_fnotify.fd,
+ stub->args.lock_fnotify.timeout);
+ break;
+ }
default:
{
gf_log ("call-stub",
@@ -3232,6 +3333,34 @@ call_resume_unwind (call_stub_t *stub)
break;
}
+ case GF_FOP_LOCK_NOTIFY:
+ {
+ if (!stub->args.lock_notify_cbk.fn)
+ STACK_UNWIND (stub->frame,
+ stub->args.lock_notify_cbk.op_ret,
+ stub->args.lock_notify_cbk.op_errno);
+ else
+ stub->args.lock_notify_cbk.fn (stub->frame,
+ stub->frame->cookie,
+ stub->frame->this,
+ stub->args.lock_notify_cbk.op_ret,
+ stub->args.lock_notify_cbk.op_errno);
+ break;
+ }
+ case GF_FOP_LOCK_FNOTIFY:
+ {
+ if (!stub->args.lock_fnotify_cbk.fn)
+ STACK_UNWIND (stub->frame,
+ stub->args.lock_fnotify_cbk.op_ret,
+ stub->args.lock_fnotify_cbk.op_errno);
+ else
+ stub->args.lock_fnotify_cbk.fn (stub->frame,
+ stub->frame->cookie,
+ stub->frame->this,
+ stub->args.lock_fnotify_cbk.op_ret,
+ stub->args.lock_fnotify_cbk.op_errno);
+ break;
+ }
case GF_FOP_MAXVALUE:
{
gf_log ("call-stub",
@@ -3540,6 +3669,17 @@ call_stub_destroy_wind (call_stub_t *stub)
dict_unref (stub->args.xattrop.xattr);
break;
}
+ case GF_FOP_LOCK_NOTIFY:
+ {
+ loc_wipe (&stub->args.lock_notify.loc);
+ break;
+ }
+ case GF_FOP_LOCK_FNOTIFY:
+ {
+ if (stub->args.lock_fnotify.fd)
+ fd_unref (stub->args.lock_fnotify.fd);
+ break;
+ }
case GF_FOP_MAXVALUE:
{
gf_log ("call-stub",
diff --git a/libglusterfs/src/call-stub.h b/libglusterfs/src/call-stub.h
index 12e94a158..d08098b95 100644
--- a/libglusterfs/src/call-stub.h
+++ b/libglusterfs/src/call-stub.h
@@ -567,6 +567,29 @@ typedef struct {
int32_t op_errno;
dict_t *xattr;
} fxattrop_cbk;
+
+ struct {
+ fop_lock_notify_t fn;
+ loc_t loc;
+ int32_t timeout;
+ } lock_notify;
+ struct {
+ fop_lock_notify_cbk_t fn;
+ int32_t op_ret;
+ int32_t op_errno;
+ } lock_notify_cbk;
+
+ struct {
+ fop_lock_fnotify_t fn;
+ fd_t *fd;
+ int32_t timeout;
+ } lock_fnotify;
+ struct {
+ fop_lock_fnotify_cbk_t fn;
+ int32_t op_ret;
+ int32_t op_errno;
+ } lock_fnotify_cbk;
+
} args;
} call_stub_t;
@@ -1099,6 +1122,30 @@ fop_fxattrop_stub_cbk_stub (call_frame_t *frame,
int32_t op_ret,
int32_t op_errno);
+call_stub_t *
+fop_lock_notify_stub_cbk_stub (call_frame_t *frame,
+ fop_lock_notify_cbk_t fn,
+ int32_t op_ret,
+ int32_t op_errno);
+
+call_stub_t *
+fop_lock_notify_stub (call_frame_t *frame,
+ fop_lock_notify_t fn,
+ loc_t *loc,
+ int32_t timeout);
+
+call_stub_t *
+fop_lock_fnotify_stub_cbk_stub (call_frame_t *frame,
+ fop_lock_fnotify_cbk_t fn,
+ int32_t op_ret,
+ int32_t op_errno);
+
+call_stub_t *
+fop_lock_fnotify_stub (call_frame_t *frame,
+ fop_lock_fnotify_t fn,
+ fd_t *fd,
+ int32_t timeout);
+
void call_resume (call_stub_t *stub);
void call_stub_destroy (call_stub_t *stub);
#endif
diff --git a/libglusterfs/src/common-utils.c b/libglusterfs/src/common-utils.c
index acac5e052..14e0d5790 100644
--- a/libglusterfs/src/common-utils.c
+++ b/libglusterfs/src/common-utils.c
@@ -207,6 +207,8 @@ gf_global_variable_init()
gf_fop_list[GF_FOP_FENTRYLK] = "FENTRYLK"; /* 40 */
gf_fop_list[GF_FOP_CHECKSUM] = "CHECKSUM"; /* 41 */
gf_fop_list[GF_FOP_XATTROP] = "XATTROP";
+ gf_fop_list[GF_FOP_LOCK_NOTIFY] = "LOCK_NOTIFY";
+ gf_fop_list[GF_FOP_LOCK_FNOTIFY]= "LOCK_FNOTIFY";
gf_mop_list[GF_MOP_SETVOLUME] = "SETVOLUME"; /* 0 */
gf_mop_list[GF_MOP_GETVOLUME] = "GETVOLUME"; /* 1 */
diff --git a/libglusterfs/src/defaults.c b/libglusterfs/src/defaults.c
index 575e3d86e..867c664cb 100644
--- a/libglusterfs/src/defaults.c
+++ b/libglusterfs/src/defaults.c
@@ -1337,6 +1337,51 @@ default_readdir (call_frame_t *frame,
return 0;
}
+
+int32_t
+default_lock_notify_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
+ int32_t op_ret, int32_t op_errno)
+{
+ STACK_UNWIND (frame, op_ret, op_errno);
+ return 0;
+}
+
+
+int32_t
+default_lock_fnotify_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
+ int32_t op_ret, int32_t op_errno)
+{
+ STACK_UNWIND (frame, op_ret, op_errno);
+ return 0;
+}
+
+
+int32_t
+default_lock_notify (call_frame_t *frame, xlator_t *this,
+ loc_t *loc, int32_t timeout)
+{
+ STACK_WIND (frame,
+ default_lock_notify_cbk,
+ FIRST_CHILD (this),
+ FIRST_CHILD (this)->fops->lock_notify,
+ loc, timeout);
+ return 0;
+}
+
+
+int32_t
+default_lock_fnotify (call_frame_t *frame, xlator_t *this,
+ fd_t *fd, int32_t timeout)
+{
+ STACK_WIND (frame,
+ default_lock_notify_cbk,
+ FIRST_CHILD (this),
+ FIRST_CHILD (this)->fops->lock_fnotify,
+ fd, timeout);
+ return 0;
+}
+
+
/* notify */
int32_t
default_notify (xlator_t *this,
diff --git a/libglusterfs/src/defaults.h b/libglusterfs/src/defaults.h
index aa15df599..cba54080b 100644
--- a/libglusterfs/src/defaults.h
+++ b/libglusterfs/src/defaults.h
@@ -256,6 +256,15 @@ int32_t default_fxattrop (call_frame_t *frame,
gf_xattrop_flags_t flags,
dict_t *dict);
+int32_t
+default_lock_notify (call_frame_t *frame, xlator_t *this,
+ loc_t *loc, int32_t timeout);
+
+int32_t
+default_lock_fnotify (call_frame_t *frame, xlator_t *this,
+ fd_t *fd, int32_t timeout);
+
+
int32_t default_notify (xlator_t *this,
int32_t event,
void *data,
diff --git a/libglusterfs/src/glusterfs.h b/libglusterfs/src/glusterfs.h
index 6ec8a2a63..7aadae21a 100644
--- a/libglusterfs/src/glusterfs.h
+++ b/libglusterfs/src/glusterfs.h
@@ -124,6 +124,8 @@ typedef enum {
GF_FOP_CHECKSUM,
GF_FOP_XATTROP, /* 40 */
GF_FOP_FXATTROP,
+ GF_FOP_LOCK_NOTIFY,
+ GF_FOP_LOCK_FNOTIFY,
GF_FOP_MAXVALUE,
} glusterfs_fop_t;
diff --git a/libglusterfs/src/protocol.h b/libglusterfs/src/protocol.h
index 4ba869dee..5f7225152 100644
--- a/libglusterfs/src/protocol.h
+++ b/libglusterfs/src/protocol.h
@@ -651,6 +651,20 @@ typedef struct {
typedef struct {
+ uint64_t ino;
+ int32_t timeout;
+} __attribute__((packed)) gf_fop_lock_notify_req_t;
+typedef struct { } __attribute__((packed)) gf_fop_lock_notify_rsp_t;
+
+
+typedef struct {
+ int64_t fd;
+ int32_t timeout;
+} __attribute__((packed)) gf_fop_lock_fnotify_req_t;
+typedef struct { } __attribute__((packed)) gf_fop_lock_fnotify_rsp_t;
+
+
+typedef struct {
char name[0];
} __attribute__((packed)) gf_mop_lock_req_t;
typedef struct {} __attribute__((packed)) gf_mop_lock_rsp_t;
diff --git a/libglusterfs/src/xlator.c b/libglusterfs/src/xlator.c
index 19f6a7f38..235f2aaa6 100644
--- a/libglusterfs/src/xlator.c
+++ b/libglusterfs/src/xlator.c
@@ -95,7 +95,9 @@ fill_defaults (xlator_t *xl)
SET_DEFAULT_FOP (checksum);
SET_DEFAULT_FOP (xattrop);
SET_DEFAULT_FOP (fxattrop);
-
+ SET_DEFAULT_FOP (lock_notify);
+ SET_DEFAULT_FOP (lock_fnotify);
+
SET_DEFAULT_MOP (stats);
SET_DEFAULT_CBK (release);
diff --git a/libglusterfs/src/xlator.h b/libglusterfs/src/xlator.h
index a24184ab8..b8722b2f6 100644
--- a/libglusterfs/src/xlator.h
+++ b/libglusterfs/src/xlator.h
@@ -416,6 +416,18 @@ typedef int32_t (*fop_fxattrop_cbk_t) (call_frame_t *frame,
int32_t op_errno,
dict_t *xattr);
+typedef int32_t (*fop_lock_notify_cbk_t) (call_frame_t *frame,
+ void *cookie,
+ xlator_t *this,
+ int32_t op_ret,
+ int32_t op_errno);
+
+typedef int32_t (*fop_lock_fnotify_cbk_t) (call_frame_t *frame,
+ void *cookie,
+ xlator_t *this,
+ int32_t op_ret,
+ int32_t op_errno);
+
typedef int32_t (*fop_lookup_t) (call_frame_t *frame,
xlator_t *this,
loc_t *loc,
@@ -635,6 +647,14 @@ typedef int32_t (*fop_fxattrop_t) (call_frame_t *frame,
gf_xattrop_flags_t optype,
dict_t *xattr);
+typedef int32_t (*fop_lock_notify_t) (call_frame_t *frame,
+ xlator_t *this, loc_t *loc,
+ int32_t timeout);
+
+typedef int32_t (*fop_lock_fnotify_t) (call_frame_t *frame,
+ xlator_t *this, fd_t *fd,
+ int32_t timeout);
+
struct xlator_fops {
fop_lookup_t lookup;
fop_stat_t stat;
@@ -677,7 +697,9 @@ struct xlator_fops {
fop_getdents_t getdents;
fop_checksum_t checksum;
fop_xattrop_t xattrop;
- fop_fxattrop_t fxattrop;
+ fop_fxattrop_t fxattrop;
+ fop_lock_notify_t lock_notify;
+ fop_lock_fnotify_t lock_fnotify;
/* these entries are used for a typechecking hack in STACK_WIND _only_ */
fop_lookup_cbk_t lookup_cbk;
@@ -722,6 +744,8 @@ struct xlator_fops {
fop_checksum_cbk_t checksum_cbk;
fop_xattrop_cbk_t xattrop_cbk;
fop_fxattrop_cbk_t fxattrop_cbk;
+ fop_lock_notify_cbk_t lock_notify_cbk;
+ fop_lock_fnotify_cbk_t lock_fnotify_cbk;
};
typedef int32_t (*cbk_forget_t) (xlator_t *this,