diff options
48 files changed, 2148 insertions, 658 deletions
diff --git a/glusterfs-guts/src/fuse-bridge.c b/glusterfs-guts/src/fuse-bridge.c index f0bf05ebd8c..156a4a86856 100644 --- a/glusterfs-guts/src/fuse-bridge.c +++ b/glusterfs-guts/src/fuse-bridge.c @@ -316,7 +316,8 @@ fuse_lookup_cbk (call_frame_t *frame, int32_t op_errno, inode_t *inode, struct stat *stat, - dict_t *dict); + dict_t *dict, + struct stat *postparent); static int32_t fuse_entry_cbk (call_frame_t *frame, diff --git a/libglusterfs/src/call-stub.c b/libglusterfs/src/call-stub.c index 89a212807d0..bc7d556c22f 100644 --- a/libglusterfs/src/call-stub.c +++ b/libglusterfs/src/call-stub.c @@ -82,7 +82,8 @@ fop_lookup_cbk_stub (call_frame_t *frame, int32_t op_errno, inode_t *inode, struct stat *buf, - dict_t *dict) + dict_t *dict, + struct stat *postparent) { call_stub_t *stub = NULL; @@ -100,6 +101,8 @@ fop_lookup_cbk_stub (call_frame_t *frame, stub->args.lookup_cbk.buf = *buf; if (dict) stub->args.lookup_cbk.dict = dict_ref (dict); + if (postparent) + stub->args.lookup_cbk.postparent = *postparent; out: return stub; } @@ -412,7 +415,8 @@ fop_truncate_cbk_stub (call_frame_t *frame, fop_truncate_cbk_t fn, int32_t op_ret, int32_t op_errno, - struct stat *buf) + struct stat *prebuf, + struct stat *postbuf) { call_stub_t *stub = NULL; @@ -424,8 +428,10 @@ fop_truncate_cbk_stub (call_frame_t *frame, stub->args.truncate_cbk.fn = fn; stub->args.truncate_cbk.op_ret = op_ret; stub->args.truncate_cbk.op_errno = op_errno; - if (buf) - stub->args.truncate_cbk.buf = *buf; + if (prebuf) + stub->args.truncate_cbk.prebuf = *prebuf; + if (postbuf) + stub->args.truncate_cbk.postbuf = *postbuf; out: return stub; } @@ -459,7 +465,8 @@ fop_ftruncate_cbk_stub (call_frame_t *frame, fop_ftruncate_cbk_t fn, int32_t op_ret, int32_t op_errno, - struct stat *buf) + struct stat *prebuf, + struct stat *postbuf) { call_stub_t *stub = NULL; @@ -471,8 +478,10 @@ fop_ftruncate_cbk_stub (call_frame_t *frame, stub->args.ftruncate_cbk.fn = fn; stub->args.ftruncate_cbk.op_ret = op_ret; stub->args.ftruncate_cbk.op_errno = op_errno; - if (buf) - stub->args.ftruncate_cbk.buf = *buf; + if (prebuf) + stub->args.ftruncate_cbk.prebuf = *prebuf; + if (postbuf) + stub->args.ftruncate_cbk.postbuf = *postbuf; out: return stub; } @@ -595,7 +604,8 @@ fop_readlink_cbk_stub (call_frame_t *frame, fop_readlink_cbk_t fn, int32_t op_ret, int32_t op_errno, - const char *path) + const char *path, + struct stat *sbuf) { call_stub_t *stub = NULL; @@ -609,6 +619,8 @@ fop_readlink_cbk_stub (call_frame_t *frame, stub->args.readlink_cbk.op_errno = op_errno; if (path) stub->args.readlink_cbk.buf = strdup (path); + if (sbuf) + stub->args.readlink_cbk.sbuf = *sbuf; out: return stub; } @@ -644,7 +656,9 @@ fop_mknod_cbk_stub (call_frame_t *frame, int32_t op_ret, int32_t op_errno, inode_t *inode, - struct stat *buf) + struct stat *buf, + struct stat *preparent, + struct stat *postparent) { call_stub_t *stub = NULL; @@ -660,6 +674,10 @@ fop_mknod_cbk_stub (call_frame_t *frame, stub->args.mknod_cbk.inode = inode_ref (inode); if (buf) stub->args.mknod_cbk.buf = *buf; + if (preparent) + stub->args.mknod_cbk.preparent = *preparent; + if (postparent) + stub->args.mknod_cbk.postparent = *postparent; out: return stub; } @@ -693,7 +711,9 @@ fop_mkdir_cbk_stub (call_frame_t *frame, int32_t op_ret, int32_t op_errno, inode_t *inode, - struct stat *buf) + struct stat *buf, + struct stat *preparent, + struct stat *postparent) { call_stub_t *stub = NULL; @@ -709,6 +729,10 @@ fop_mkdir_cbk_stub (call_frame_t *frame, stub->args.mkdir_cbk.inode = inode_ref (inode); if (buf) stub->args.mkdir_cbk.buf = *buf; + if (preparent) + stub->args.mkdir_cbk.preparent = *preparent; + if (postparent) + stub->args.mkdir_cbk.postparent = *postparent; out: return stub; } @@ -738,7 +762,9 @@ call_stub_t * fop_unlink_cbk_stub (call_frame_t *frame, fop_unlink_cbk_t fn, int32_t op_ret, - int32_t op_errno) + int32_t op_errno, + struct stat *preparent, + struct stat *postparent) { call_stub_t *stub = NULL; @@ -750,6 +776,10 @@ fop_unlink_cbk_stub (call_frame_t *frame, stub->args.unlink_cbk.fn = fn; stub->args.unlink_cbk.op_ret = op_ret; stub->args.unlink_cbk.op_errno = op_errno; + if (preparent) + stub->args.unlink_cbk.preparent = *preparent; + if (postparent) + stub->args.unlink_cbk.postparent = *postparent; out: return stub; } @@ -780,7 +810,9 @@ call_stub_t * fop_rmdir_cbk_stub (call_frame_t *frame, fop_rmdir_cbk_t fn, int32_t op_ret, - int32_t op_errno) + int32_t op_errno, + struct stat *preparent, + struct stat *postparent) { call_stub_t *stub = NULL; @@ -792,6 +824,10 @@ fop_rmdir_cbk_stub (call_frame_t *frame, stub->args.rmdir_cbk.fn = fn; stub->args.rmdir_cbk.op_ret = op_ret; stub->args.rmdir_cbk.op_errno = op_errno; + if (preparent) + stub->args.rmdir_cbk.preparent = *preparent; + if (postparent) + stub->args.rmdir_cbk.postparent = *postparent; out: return stub; } @@ -826,7 +862,9 @@ fop_symlink_cbk_stub (call_frame_t *frame, int32_t op_ret, int32_t op_errno, inode_t *inode, - struct stat *buf) + struct stat *buf, + struct stat *preparent, + struct stat *postparent) { call_stub_t *stub = NULL; @@ -842,6 +880,10 @@ fop_symlink_cbk_stub (call_frame_t *frame, stub->args.symlink_cbk.inode = inode_ref (inode); if (buf) stub->args.symlink_cbk.buf = *buf; + if (preparent) + stub->args.symlink_cbk.preparent = *preparent; + if (postparent) + stub->args.symlink_cbk.postparent = *postparent; out: return stub; } @@ -875,7 +917,11 @@ fop_rename_cbk_stub (call_frame_t *frame, fop_rename_cbk_t fn, int32_t op_ret, int32_t op_errno, - struct stat *buf) + struct stat *buf, + struct stat *preoldparent, + struct stat *postoldparent, + struct stat *prenewparent, + struct stat *postnewparent) { call_stub_t *stub = NULL; @@ -889,6 +935,14 @@ fop_rename_cbk_stub (call_frame_t *frame, stub->args.rename_cbk.op_errno = op_errno; if (buf) stub->args.rename_cbk.buf = *buf; + if (preoldparent) + stub->args.rename_cbk.preoldparent = *preoldparent; + if (postoldparent) + stub->args.rename_cbk.postoldparent = *postoldparent; + if (prenewparent) + stub->args.rename_cbk.prenewparent = *prenewparent; + if (postnewparent) + stub->args.rename_cbk.postnewparent = *postnewparent; out: return stub; } @@ -924,7 +978,9 @@ fop_link_cbk_stub (call_frame_t *frame, int32_t op_ret, int32_t op_errno, inode_t *inode, - struct stat *buf) + struct stat *buf, + struct stat *preparent, + struct stat *postparent) { call_stub_t *stub = NULL; @@ -940,6 +996,10 @@ fop_link_cbk_stub (call_frame_t *frame, stub->args.link_cbk.inode = inode_ref (inode); if (buf) stub->args.link_cbk.buf = *buf; + if (preparent) + stub->args.link_cbk.preparent = *preparent; + if (postparent) + stub->args.link_cbk.postparent = *postparent; out: return stub; } @@ -978,7 +1038,9 @@ fop_create_cbk_stub (call_frame_t *frame, int32_t op_errno, fd_t *fd, inode_t *inode, - struct stat *buf) + struct stat *buf, + struct stat *preparent, + struct stat *postparent) { call_stub_t *stub = NULL; @@ -996,6 +1058,10 @@ fop_create_cbk_stub (call_frame_t *frame, stub->args.create_cbk.inode = inode_ref (inode); if (buf) stub->args.create_cbk.buf = *buf; + if (preparent) + stub->args.create_cbk.preparent = *preparent; + if (postparent) + stub->args.create_cbk.postparent = *postparent; out: return stub; } @@ -1005,7 +1071,8 @@ call_stub_t * fop_open_stub (call_frame_t *frame, fop_open_t fn, loc_t *loc, - int32_t flags, fd_t *fd) + int32_t flags, fd_t *fd, + int32_t wbflags) { call_stub_t *stub = NULL; @@ -1018,6 +1085,7 @@ fop_open_stub (call_frame_t *frame, stub->args.open.fn = fn; loc_copy (&stub->args.open.loc, loc); stub->args.open.flags = flags; + stub->args.open.wbflags = wbflags; if (fd) stub->args.open.fd = fd_ref (fd); out: @@ -1140,7 +1208,8 @@ fop_writev_cbk_stub (call_frame_t *frame, fop_writev_cbk_t fn, int32_t op_ret, int32_t op_errno, - struct stat *stbuf) + struct stat *prebuf, + struct stat *postbuf) { call_stub_t *stub = NULL; @@ -1154,7 +1223,9 @@ fop_writev_cbk_stub (call_frame_t *frame, stub->args.writev_cbk.op_ret = op_ret; stub->args.writev_cbk.op_errno = op_errno; if (op_ret >= 0) - stub->args.writev_cbk.stbuf = *stbuf; + stub->args.writev_cbk.postbuf = *postbuf; + if (prebuf) + stub->args.writev_cbk.prebuf = *prebuf; out: return stub; } @@ -1231,8 +1302,9 @@ call_stub_t * fop_fsync_cbk_stub (call_frame_t *frame, fop_fsync_cbk_t fn, int32_t op_ret, - int32_t op_errno) - + int32_t op_errno, + struct stat *prebuf, + struct stat *postbuf) { call_stub_t *stub = NULL; @@ -1244,6 +1316,10 @@ fop_fsync_cbk_stub (call_frame_t *frame, stub->args.fsync_cbk.fn = fn; stub->args.fsync_cbk.op_ret = op_ret; stub->args.fsync_cbk.op_errno = op_errno; + if (prebuf) + stub->args.fsync_cbk.prebuf = *prebuf; + if (postbuf) + stub->args.fsync_cbk.postbuf = *postbuf; out: return stub; } @@ -2459,7 +2535,8 @@ call_resume_wind (call_stub_t *stub) stub->args.open.fn (stub->frame, stub->frame->this, &stub->args.open.loc, - stub->args.open.flags, stub->args.open.fd); + stub->args.open.flags, stub->args.open.fd, + stub->args.open.wbflags); break; } case GF_FOP_CREATE: @@ -2958,7 +3035,9 @@ call_resume_unwind (call_stub_t *stub) stub->args.create_cbk.op_errno, stub->args.create_cbk.fd, stub->args.create_cbk.inode, - &stub->args.create_cbk.buf); + &stub->args.create_cbk.buf, + &stub->args.create_cbk.preparent, + &stub->args.create_cbk.postparent); else stub->args.create_cbk.fn (stub->frame, stub->frame->cookie, @@ -2967,7 +3046,9 @@ call_resume_unwind (call_stub_t *stub) stub->args.create_cbk.op_errno, stub->args.create_cbk.fd, stub->args.create_cbk.inode, - &stub->args.create_cbk.buf); + &stub->args.create_cbk.buf, + &stub->args.create_cbk.preparent, + &stub->args.create_cbk.postparent); break; } @@ -2996,14 +3077,16 @@ call_resume_unwind (call_stub_t *stub) STACK_UNWIND (stub->frame, stub->args.readlink_cbk.op_ret, stub->args.readlink_cbk.op_errno, - stub->args.readlink_cbk.buf); + stub->args.readlink_cbk.buf, + &stub->args.readlink_cbk.sbuf); else stub->args.readlink_cbk.fn (stub->frame, stub->frame->cookie, stub->frame->this, stub->args.readlink_cbk.op_ret, stub->args.readlink_cbk.op_errno, - stub->args.readlink_cbk.buf); + stub->args.readlink_cbk.buf, + &stub->args.readlink_cbk.sbuf); break; } @@ -3015,7 +3098,9 @@ call_resume_unwind (call_stub_t *stub) stub->args.mknod_cbk.op_ret, stub->args.mknod_cbk.op_errno, stub->args.mknod_cbk.inode, - &stub->args.mknod_cbk.buf); + &stub->args.mknod_cbk.buf, + &stub->args.mknod_cbk.preparent, + &stub->args.mknod_cbk.postparent); else stub->args.mknod_cbk.fn (stub->frame, stub->frame->cookie, @@ -3023,7 +3108,9 @@ call_resume_unwind (call_stub_t *stub) stub->args.mknod_cbk.op_ret, stub->args.mknod_cbk.op_errno, stub->args.mknod_cbk.inode, - &stub->args.mknod_cbk.buf); + &stub->args.mknod_cbk.buf, + &stub->args.mknod_cbk.preparent, + &stub->args.mknod_cbk.postparent); break; } @@ -3034,7 +3121,9 @@ call_resume_unwind (call_stub_t *stub) stub->args.mkdir_cbk.op_ret, stub->args.mkdir_cbk.op_errno, stub->args.mkdir_cbk.inode, - &stub->args.mkdir_cbk.buf); + &stub->args.mkdir_cbk.buf, + &stub->args.mkdir_cbk.preparent, + &stub->args.mkdir_cbk.postparent); else stub->args.mkdir_cbk.fn (stub->frame, stub->frame->cookie, @@ -3042,7 +3131,9 @@ call_resume_unwind (call_stub_t *stub) stub->args.mkdir_cbk.op_ret, stub->args.mkdir_cbk.op_errno, stub->args.mkdir_cbk.inode, - &stub->args.mkdir_cbk.buf); + &stub->args.mkdir_cbk.buf, + &stub->args.mkdir_cbk.preparent, + &stub->args.mkdir_cbk.postparent); if (stub->args.mkdir_cbk.inode) inode_unref (stub->args.mkdir_cbk.inode); @@ -3055,13 +3146,17 @@ call_resume_unwind (call_stub_t *stub) if (!stub->args.unlink_cbk.fn) STACK_UNWIND (stub->frame, stub->args.unlink_cbk.op_ret, - stub->args.unlink_cbk.op_errno); + stub->args.unlink_cbk.op_errno, + &stub->args.unlink_cbk.preparent, + &stub->args.unlink_cbk.postparent); else stub->args.unlink_cbk.fn (stub->frame, stub->frame->cookie, stub->frame->this, stub->args.unlink_cbk.op_ret, - stub->args.unlink_cbk.op_errno); + stub->args.unlink_cbk.op_errno, + &stub->args.unlink_cbk.preparent, + &stub->args.unlink_cbk.postparent); break; } @@ -3070,13 +3165,17 @@ call_resume_unwind (call_stub_t *stub) if (!stub->args.rmdir_cbk.fn) STACK_UNWIND (stub->frame, stub->args.rmdir_cbk.op_ret, - stub->args.rmdir_cbk.op_errno); + stub->args.rmdir_cbk.op_errno, + &stub->args.rmdir_cbk.preparent, + &stub->args.rmdir_cbk.postparent); else stub->args.unlink_cbk.fn (stub->frame, stub->frame->cookie, stub->frame->this, stub->args.rmdir_cbk.op_ret, - stub->args.rmdir_cbk.op_errno); + stub->args.rmdir_cbk.op_errno, + &stub->args.rmdir_cbk.preparent, + &stub->args.rmdir_cbk.postparent); break; } @@ -3087,7 +3186,9 @@ call_resume_unwind (call_stub_t *stub) stub->args.symlink_cbk.op_ret, stub->args.symlink_cbk.op_errno, stub->args.symlink_cbk.inode, - &stub->args.symlink_cbk.buf); + &stub->args.symlink_cbk.buf, + &stub->args.symlink_cbk.preparent, + &stub->args.symlink_cbk.postparent); else stub->args.symlink_cbk.fn (stub->frame, stub->frame->cookie, @@ -3095,7 +3196,9 @@ call_resume_unwind (call_stub_t *stub) stub->args.symlink_cbk.op_ret, stub->args.symlink_cbk.op_errno, stub->args.symlink_cbk.inode, - &stub->args.symlink_cbk.buf); + &stub->args.symlink_cbk.buf, + &stub->args.symlink_cbk.preparent, + &stub->args.symlink_cbk.postparent); } break; @@ -3106,14 +3209,22 @@ call_resume_unwind (call_stub_t *stub) STACK_UNWIND (stub->frame, stub->args.rename_cbk.op_ret, stub->args.rename_cbk.op_errno, - &stub->args.rename_cbk.buf); + &stub->args.rename_cbk.buf, + &stub->args.rename_cbk.preoldparent, + &stub->args.rename_cbk.postoldparent, + &stub->args.rename_cbk.prenewparent, + &stub->args.rename_cbk.postnewparent); else stub->args.rename_cbk.fn (stub->frame, stub->frame->cookie, stub->frame->this, stub->args.rename_cbk.op_ret, stub->args.rename_cbk.op_errno, - &stub->args.rename_cbk.buf); + &stub->args.rename_cbk.buf, + &stub->args.rename_cbk.preoldparent, + &stub->args.rename_cbk.postoldparent, + &stub->args.rename_cbk.prenewparent, + &stub->args.rename_cbk.postnewparent); #endif break; } @@ -3133,7 +3244,9 @@ call_resume_unwind (call_stub_t *stub) stub->args.link_cbk.op_ret, stub->args.link_cbk.op_errno, stub->args.link_cbk.inode, - &stub->args.link_cbk.buf); + &stub->args.link_cbk.buf, + &stub->args.link_cbk.preparent, + &stub->args.link_cbk.postparent); break; } @@ -3177,14 +3290,16 @@ call_resume_unwind (call_stub_t *stub) STACK_UNWIND (stub->frame, stub->args.truncate_cbk.op_ret, stub->args.truncate_cbk.op_errno, - &stub->args.truncate_cbk.buf); + &stub->args.truncate_cbk.prebuf, + &stub->args.truncate_cbk.postbuf); else stub->args.truncate_cbk.fn (stub->frame, stub->frame->cookie, stub->frame->this, stub->args.truncate_cbk.op_ret, stub->args.truncate_cbk.op_errno, - &stub->args.truncate_cbk.buf); + &stub->args.truncate_cbk.prebuf, + &stub->args.truncate_cbk.postbuf); break; } @@ -3217,14 +3332,16 @@ call_resume_unwind (call_stub_t *stub) STACK_UNWIND (stub->frame, stub->args.writev_cbk.op_ret, stub->args.writev_cbk.op_errno, - &stub->args.writev_cbk.stbuf); + &stub->args.writev_cbk.prebuf, + &stub->args.writev_cbk.postbuf); else stub->args.writev_cbk.fn (stub->frame, stub->frame->cookie, stub->frame->this, stub->args.writev_cbk.op_ret, stub->args.writev_cbk.op_errno, - &stub->args.writev_cbk.stbuf); + &stub->args.writev_cbk.prebuf, + &stub->args.writev_cbk.postbuf); break; } @@ -3266,13 +3383,17 @@ call_resume_unwind (call_stub_t *stub) if (!stub->args.fsync_cbk.fn) STACK_UNWIND (stub->frame, stub->args.fsync_cbk.op_ret, - stub->args.fsync_cbk.op_errno); + stub->args.fsync_cbk.op_errno, + &stub->args.fsync_cbk.prebuf, + &stub->args.fsync_cbk.postbuf); else stub->args.fsync_cbk.fn (stub->frame, stub->frame->cookie, stub->frame->this, stub->args.fsync_cbk.op_ret, - stub->args.fsync_cbk.op_errno); + stub->args.fsync_cbk.op_errno, + &stub->args.fsync_cbk.prebuf, + &stub->args.fsync_cbk.postbuf); break; } @@ -3433,14 +3554,16 @@ call_resume_unwind (call_stub_t *stub) STACK_UNWIND (stub->frame, stub->args.ftruncate_cbk.op_ret, stub->args.ftruncate_cbk.op_errno, - &stub->args.ftruncate_cbk.buf); + &stub->args.ftruncate_cbk.prebuf, + &stub->args.ftruncate_cbk.postbuf); else stub->args.ftruncate_cbk.fn (stub->frame, stub->frame->cookie, stub->frame->this, stub->args.ftruncate_cbk.op_ret, stub->args.ftruncate_cbk.op_errno, - &stub->args.ftruncate_cbk.buf); + &stub->args.ftruncate_cbk.prebuf, + &stub->args.ftruncate_cbk.postbuf); break; } @@ -3605,7 +3728,8 @@ call_resume_unwind (call_stub_t *stub) stub->args.lookup_cbk.op_errno, stub->args.lookup_cbk.inode, &stub->args.lookup_cbk.buf, - stub->args.lookup_cbk.dict); + stub->args.lookup_cbk.dict, + &stub->args.lookup_cbk.postparent); else stub->args.lookup_cbk.fn (stub->frame, stub->frame->cookie, @@ -3613,8 +3737,9 @@ call_resume_unwind (call_stub_t *stub) stub->args.lookup_cbk.op_ret, stub->args.lookup_cbk.op_errno, stub->args.lookup_cbk.inode, - &stub->args.lookup_cbk.buf, - stub->args.lookup_cbk.dict); + &stub->args.lookup_cbk.buf, + stub->args.lookup_cbk.dict, + &stub->args.lookup_cbk.postparent); /* FIXME NULL should not be passed */ if (stub->args.lookup_cbk.dict) diff --git a/libglusterfs/src/call-stub.h b/libglusterfs/src/call-stub.h index 63439478cc4..88e26c24f72 100644 --- a/libglusterfs/src/call-stub.h +++ b/libglusterfs/src/call-stub.h @@ -48,6 +48,7 @@ typedef struct { inode_t *inode; struct stat buf; dict_t *dict; + struct stat postparent; } lookup_cbk; /* stat */ @@ -131,7 +132,8 @@ typedef struct { struct { fop_truncate_cbk_t fn; int32_t op_ret, op_errno; - struct stat buf; + struct stat prebuf; + struct stat postbuf; } truncate_cbk; /* ftruncate */ @@ -143,7 +145,8 @@ typedef struct { struct { fop_ftruncate_cbk_t fn; int32_t op_ret, op_errno; - struct stat buf; + struct stat prebuf; + struct stat postbuf; } ftruncate_cbk; /* utimens */ @@ -179,6 +182,7 @@ typedef struct { fop_readlink_cbk_t fn; int32_t op_ret, op_errno; const char *buf; + struct stat sbuf; } readlink_cbk; /* mknod */ @@ -193,6 +197,8 @@ typedef struct { int32_t op_ret, op_errno; inode_t *inode; struct stat buf; + struct stat preparent; + struct stat postparent; } mknod_cbk; /* mkdir */ @@ -206,6 +212,8 @@ typedef struct { int32_t op_ret, op_errno; inode_t *inode; struct stat buf; + struct stat preparent; + struct stat postparent; } mkdir_cbk; /* unlink */ @@ -216,6 +224,8 @@ typedef struct { struct { fop_unlink_cbk_t fn; int32_t op_ret, op_errno; + struct stat preparent; + struct stat postparent; } unlink_cbk; /* rmdir */ @@ -226,6 +236,8 @@ typedef struct { struct { fop_rmdir_cbk_t fn; int32_t op_ret, op_errno; + struct stat preparent; + struct stat postparent; } rmdir_cbk; /* symlink */ @@ -239,6 +251,8 @@ typedef struct { int32_t op_ret, op_errno; inode_t *inode; struct stat buf; + struct stat preparent; + struct stat postparent; } symlink_cbk; /* rename */ @@ -251,6 +265,10 @@ typedef struct { fop_rename_cbk_t fn; int32_t op_ret, op_errno; struct stat buf; + struct stat preoldparent; + struct stat postoldparent; + struct stat prenewparent; + struct stat postnewparent; } rename_cbk; /* link */ @@ -264,6 +282,8 @@ typedef struct { int32_t op_ret, op_errno; inode_t *inode; struct stat buf; + struct stat preparent; + struct stat postparent; } link_cbk; /* create */ @@ -280,6 +300,8 @@ typedef struct { fd_t *fd; inode_t *inode; struct stat buf; + struct stat preparent; + struct stat postparent; } create_cbk; /* open */ @@ -288,6 +310,7 @@ typedef struct { loc_t loc; int32_t flags; fd_t *fd; + int32_t wbflags; } open; struct { fop_open_cbk_t fn; @@ -324,7 +347,8 @@ typedef struct { struct { fop_writev_cbk_t fn; int32_t op_ret, op_errno; - struct stat stbuf; + struct stat prebuf; + struct stat postbuf; } writev_cbk; /* flush */ @@ -346,6 +370,8 @@ typedef struct { struct { fop_fsync_cbk_t fn; int32_t op_ret, op_errno; + struct stat prebuf; + struct stat postbuf; } fsync_cbk; /* opendir */ @@ -678,7 +704,8 @@ fop_lookup_cbk_stub (call_frame_t *frame, int32_t op_errno, inode_t *inode, struct stat *buf, - dict_t *dict); + dict_t *dict, + struct stat *postparent); call_stub_t * fop_stat_stub (call_frame_t *frame, fop_stat_t fn, @@ -760,7 +787,8 @@ fop_truncate_cbk_stub (call_frame_t *frame, fop_truncate_cbk_t fn, int32_t op_ret, int32_t op_errno, - struct stat *buf); + struct stat *prebuf, + struct stat *postbuf); call_stub_t * fop_ftruncate_stub (call_frame_t *frame, @@ -773,7 +801,8 @@ fop_ftruncate_cbk_stub (call_frame_t *frame, fop_ftruncate_cbk_t fn, int32_t op_ret, int32_t op_errno, - struct stat *buf); + struct stat *prebuf, + struct stat *postbuf); call_stub_t * fop_utimens_stub (call_frame_t *frame, @@ -811,7 +840,8 @@ fop_readlink_cbk_stub (call_frame_t *frame, fop_readlink_cbk_t fn, int32_t op_ret, int32_t op_errno, - const char *path); + const char *path, + struct stat *buf); call_stub_t * fop_mknod_stub (call_frame_t *frame, @@ -826,7 +856,9 @@ fop_mknod_cbk_stub (call_frame_t *frame, int32_t op_ret, int32_t op_errno, inode_t *inode, - struct stat *buf); + struct stat *buf, + struct stat *preparent, + struct stat *postparent); call_stub_t * fop_mkdir_stub (call_frame_t *frame, @@ -840,7 +872,9 @@ fop_mkdir_cbk_stub (call_frame_t *frame, int32_t op_ret, int32_t op_errno, inode_t *inode, - struct stat *buf); + struct stat *buf, + struct stat *preparent, + struct stat *postparent); call_stub_t * fop_unlink_stub (call_frame_t *frame, @@ -851,7 +885,9 @@ call_stub_t * fop_unlink_cbk_stub (call_frame_t *frame, fop_unlink_cbk_t fn, int32_t op_ret, - int32_t op_errno); + int32_t op_errno, + struct stat *preparent, + struct stat *postparent); call_stub_t * fop_rmdir_stub (call_frame_t *frame, @@ -862,7 +898,9 @@ call_stub_t * fop_rmdir_cbk_stub (call_frame_t *frame, fop_rmdir_cbk_t fn, int32_t op_ret, - int32_t op_errno); + int32_t op_errno, + struct stat *preparent, + struct stat *postparent); call_stub_t * fop_symlink_stub (call_frame_t *frame, @@ -876,7 +914,9 @@ fop_symlink_cbk_stub (call_frame_t *frame, int32_t op_ret, int32_t op_errno, inode_t *inode, - struct stat *buf); + struct stat *buf, + struct stat *preparent, + struct stat *postparent); call_stub_t * fop_rename_stub (call_frame_t *frame, @@ -889,7 +929,11 @@ fop_rename_cbk_stub (call_frame_t *frame, fop_rename_cbk_t fn, int32_t op_ret, int32_t op_errno, - struct stat *buf); + struct stat *buf, + struct stat *preoldparent, + struct stat *postoldparent, + struct stat *prenewparent, + struct stat *postnewparent); call_stub_t * fop_link_stub (call_frame_t *frame, @@ -903,7 +947,9 @@ fop_link_cbk_stub (call_frame_t *frame, int32_t op_ret, int32_t op_errno, inode_t *inode, - struct stat *buf); + struct stat *buf, + struct stat *preparent, + struct stat *postparent); call_stub_t * fop_create_stub (call_frame_t *frame, @@ -919,14 +965,17 @@ fop_create_cbk_stub (call_frame_t *frame, int32_t op_errno, fd_t *fd, inode_t *inode, - struct stat *buf); + struct stat *buf, + struct stat *preparent, + struct stat *postparent); call_stub_t * fop_open_stub (call_frame_t *frame, fop_open_t fn, loc_t *loc, int32_t flags, - fd_t *fd); + fd_t *fd, + int32_t wbflags); call_stub_t * fop_open_cbk_stub (call_frame_t *frame, @@ -966,7 +1015,8 @@ fop_writev_cbk_stub (call_frame_t *frame, fop_writev_cbk_t fn, int32_t op_ret, int32_t op_errno, - struct stat *stbuf); + struct stat *prebuf, + struct stat *postbuf); call_stub_t * fop_flush_stub (call_frame_t *frame, @@ -989,7 +1039,9 @@ call_stub_t * fop_fsync_cbk_stub (call_frame_t *frame, fop_fsync_cbk_t fn, int32_t op_ret, - int32_t op_errno); + int32_t op_errno, + struct stat *prebuf, + struct stat *postbuf); call_stub_t * fop_opendir_stub (call_frame_t *frame, diff --git a/libglusterfs/src/defaults.c b/libglusterfs/src/defaults.c index f72eca1f819..a2163010331 100644 --- a/libglusterfs/src/defaults.c +++ b/libglusterfs/src/defaults.c @@ -41,14 +41,16 @@ default_lookup_cbk (call_frame_t *frame, int32_t op_errno, inode_t *inode, struct stat *buf, - dict_t *dict) + dict_t *dict, + struct stat *postparent) { STACK_UNWIND (frame, op_ret, op_errno, inode, buf, - dict); + dict, + postparent); return 0; } @@ -234,12 +236,14 @@ default_truncate_cbk (call_frame_t *frame, xlator_t *this, int32_t op_ret, int32_t op_errno, - struct stat *buf) + struct stat *prebuf, + struct stat *postbuf) { STACK_UNWIND (frame, op_ret, op_errno, - buf); + prebuf, + postbuf); return 0; } @@ -264,12 +268,14 @@ default_ftruncate_cbk (call_frame_t *frame, xlator_t *this, int32_t op_ret, int32_t op_errno, - struct stat *buf) + struct stat *prebuf, + struct stat *postbuf) { STACK_UNWIND (frame, op_ret, op_errno, - buf); + prebuf, + postbuf); return 0; } @@ -354,12 +360,14 @@ default_readlink_cbk (call_frame_t *frame, xlator_t *this, int32_t op_ret, int32_t op_errno, - const char *path) + const char *path, + struct stat *buf) { STACK_UNWIND (frame, op_ret, op_errno, - path); + path, + buf); return 0; } @@ -386,13 +394,17 @@ default_mknod_cbk (call_frame_t *frame, int32_t op_ret, int32_t op_errno, inode_t *inode, - struct stat *buf) + struct stat *buf, + struct stat *preparent, + struct stat *postparent) { STACK_UNWIND (frame, op_ret, op_errno, inode, - buf); + buf, + preparent, + postparent); return 0; } @@ -418,13 +430,17 @@ default_mkdir_cbk (call_frame_t *frame, int32_t op_ret, int32_t op_errno, inode_t *inode, - struct stat *buf) + struct stat *buf, + struct stat *preparent, + struct stat *postparent) { STACK_UNWIND (frame, op_ret, op_errno, inode, - buf); + buf, + preparent, + postparent); return 0; } @@ -447,9 +463,11 @@ default_unlink_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int32_t op_ret, - int32_t op_errno) + int32_t op_errno, + struct stat *preparent, + struct stat *postparent) { - STACK_UNWIND (frame, op_ret, op_errno); + STACK_UNWIND (frame, op_ret, op_errno, preparent, postparent); return 0; } @@ -471,11 +489,15 @@ default_rmdir_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int32_t op_ret, - int32_t op_errno) + int32_t op_errno, + struct stat *preparent, + struct stat *postparent) { STACK_UNWIND (frame, op_ret, - op_errno); + op_errno, + preparent, + postparent); return 0; } @@ -500,9 +522,12 @@ default_symlink_cbk (call_frame_t *frame, int32_t op_ret, int32_t op_errno, inode_t *inode, - struct stat *buf) + struct stat *buf, + struct stat *preparent, + struct stat *postparent) { - STACK_UNWIND (frame, op_ret, op_errno, inode, buf); + STACK_UNWIND (frame, op_ret, op_errno, inode, buf, preparent, + postparent); return 0; } @@ -527,9 +552,14 @@ default_rename_cbk (call_frame_t *frame, xlator_t *this, int32_t op_ret, int32_t op_errno, - struct stat *buf) + struct stat *buf, + struct stat *preoldparent, + struct stat *postoldparent, + struct stat *prenewparent, + struct stat *postnewparent) { - STACK_UNWIND (frame, op_ret, op_errno, buf); + STACK_UNWIND (frame, op_ret, op_errno, buf, preoldparent, postoldparent, + prenewparent, postnewparent); return 0; } @@ -555,9 +585,12 @@ default_link_cbk (call_frame_t *frame, int32_t op_ret, int32_t op_errno, inode_t *inode, - struct stat *buf) + struct stat *buf, + struct stat *preparent, + struct stat *postparent) { - STACK_UNWIND (frame, op_ret, op_errno, inode, buf); + STACK_UNWIND (frame, op_ret, op_errno, inode, buf, preparent, + postparent); return 0; } @@ -584,9 +617,12 @@ default_create_cbk (call_frame_t *frame, int32_t op_errno, fd_t *fd, inode_t *inode, - struct stat *buf) + struct stat *buf, + struct stat *preparent, + struct stat *postparent) { - STACK_UNWIND (frame, op_ret, op_errno, fd, inode, buf); + STACK_UNWIND (frame, op_ret, op_errno, fd, inode, buf, preparent, + postparent); return 0; } @@ -623,13 +659,14 @@ int32_t default_open (call_frame_t *frame, xlator_t *this, loc_t *loc, - int32_t flags, fd_t *fd) + int32_t flags, fd_t *fd, + int32_t wbflags) { STACK_WIND (frame, default_open_cbk, FIRST_CHILD(this), FIRST_CHILD(this)->fops->open, - loc, flags, fd); + loc, flags, fd, wbflags); return 0; } @@ -678,12 +715,14 @@ default_writev_cbk (call_frame_t *frame, xlator_t *this, int32_t op_ret, int32_t op_errno, - struct stat *stbuf) + struct stat *prebuf, + struct stat *postbuf) { STACK_UNWIND (frame, op_ret, op_errno, - stbuf); + prebuf, + postbuf); return 0; } @@ -740,11 +779,15 @@ default_fsync_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int32_t op_ret, - int32_t op_errno) + int32_t op_errno, + struct stat *prebuf, + struct stat *postbuf) { STACK_UNWIND (frame, op_ret, - op_errno); + op_errno, + prebuf, + postbuf); return 0; } diff --git a/libglusterfs/src/defaults.h b/libglusterfs/src/defaults.h index d8b99848683..2c167d97ed4 100644 --- a/libglusterfs/src/defaults.h +++ b/libglusterfs/src/defaults.h @@ -161,7 +161,8 @@ int32_t default_create (call_frame_t *frame, int32_t default_open (call_frame_t *frame, xlator_t *this, loc_t *loc, - int32_t flags, fd_t *fd); + int32_t flags, fd_t *fd, + int32_t wbflags); int32_t default_readv (call_frame_t *frame, xlator_t *this, diff --git a/libglusterfs/src/protocol.h b/libglusterfs/src/protocol.h index 91b876a6ff3..59ebaf2bc08 100644 --- a/libglusterfs/src/protocol.h +++ b/libglusterfs/src/protocol.h @@ -337,6 +337,7 @@ typedef struct { char path[0]; /* NULL terminated */ } __attribute__((packed)) gf_fop_readlink_req_t; typedef struct { + struct gf_stat buf; char path[0]; /* NULL terminated */ } __attribute__((packed)) gf_fop_readlink_rsp_t; @@ -350,6 +351,8 @@ typedef struct { } __attribute__((packed)) gf_fop_mknod_req_t; typedef struct { struct gf_stat stat; + struct gf_stat preparent; + struct gf_stat postparent; } __attribute__((packed)) gf_fop_mknod_rsp_t; @@ -361,6 +364,8 @@ typedef struct { } __attribute__((packed)) gf_fop_mkdir_req_t; typedef struct { struct gf_stat stat; + struct gf_stat preparent; + struct gf_stat postparent; } __attribute__((packed)) gf_fop_mkdir_rsp_t; @@ -370,6 +375,8 @@ typedef struct { char bname[0]; /* NULL terminated */ } __attribute__((packed)) gf_fop_unlink_req_t; typedef struct { + struct gf_stat preparent; + struct gf_stat postparent; } __attribute__((packed)) gf_fop_unlink_rsp_t; @@ -379,6 +386,8 @@ typedef struct { char bname[0]; /* NULL terminated */ } __attribute__((packed)) gf_fop_rmdir_req_t; typedef struct { + struct gf_stat preparent; + struct gf_stat postparent; } __attribute__((packed)) gf_fop_rmdir_rsp_t; @@ -390,6 +399,8 @@ typedef struct { } __attribute__((packed)) gf_fop_symlink_req_t; typedef struct { struct gf_stat stat; + struct gf_stat preparent; + struct gf_stat postparent; }__attribute__((packed)) gf_fop_symlink_rsp_t; @@ -403,6 +414,10 @@ typedef struct { } __attribute__((packed)) gf_fop_rename_req_t; typedef struct { struct gf_stat stat; + struct gf_stat preoldparent; + struct gf_stat postoldparent; + struct gf_stat prenewparent; + struct gf_stat postnewparent; } __attribute__((packed)) gf_fop_rename_rsp_t; @@ -415,6 +430,8 @@ typedef struct { }__attribute__((packed)) gf_fop_link_req_t; typedef struct { struct gf_stat stat; + struct gf_stat preparent; + struct gf_stat postparent; } __attribute__((packed)) gf_fop_link_rsp_t; @@ -445,13 +462,15 @@ typedef struct { char path[0]; } __attribute__((packed)) gf_fop_truncate_req_t; typedef struct { - struct gf_stat stat; + struct gf_stat prestat; + struct gf_stat poststat; } __attribute__((packed)) gf_fop_truncate_rsp_t; typedef struct { uint64_t ino; uint32_t flags; + uint32_t wbflags; char path[0]; } __attribute__((packed)) gf_fop_open_req_t; typedef struct { @@ -478,7 +497,8 @@ typedef struct { uint32_t size; } __attribute__((packed)) gf_fop_write_req_t; typedef struct { - struct gf_stat stat; + struct gf_stat prestat; + struct gf_stat poststat; } __attribute__((packed)) gf_fop_write_rsp_t; @@ -504,6 +524,8 @@ typedef struct fsync_req { uint32_t data; } __attribute__((packed)) gf_fop_fsync_req_t; typedef struct { + struct gf_stat prestat; + struct gf_stat poststat; } __attribute__((packed)) gf_fop_fsync_rsp_t; @@ -636,6 +658,8 @@ typedef struct { typedef struct { struct gf_stat stat; uint64_t fd; + struct gf_stat preparent; + struct gf_stat postparent; } __attribute__((packed)) gf_fop_create_rsp_t; @@ -646,7 +670,8 @@ typedef struct { uint64_t offset; } __attribute__((packed)) gf_fop_ftruncate_req_t; typedef struct { - struct gf_stat stat; + struct gf_stat prestat; + struct gf_stat poststat; } __attribute__((packed)) gf_fop_ftruncate_rsp_t; @@ -757,6 +782,7 @@ typedef struct { } __attribute__((packed)) gf_fop_lookup_req_t; typedef struct { struct gf_stat stat; + struct gf_stat postparent; uint32_t dict_len; char dict[0]; } __attribute__((packed)) gf_fop_lookup_rsp_t; diff --git a/libglusterfs/src/xlator.h b/libglusterfs/src/xlator.h index afaaed4a4d8..a00d4975d92 100644 --- a/libglusterfs/src/xlator.h +++ b/libglusterfs/src/xlator.h @@ -172,7 +172,8 @@ typedef int32_t (*fop_lookup_cbk_t) (call_frame_t *frame, int32_t op_errno, inode_t *inode, struct stat *buf, - dict_t *xattr); + dict_t *xattr, + struct stat *postparent); typedef int32_t (*fop_stat_cbk_t) (call_frame_t *frame, void *cookie, @@ -221,14 +222,16 @@ typedef int32_t (*fop_truncate_cbk_t) (call_frame_t *frame, xlator_t *this, int32_t op_ret, int32_t op_errno, - struct stat *buf); + struct stat *prebuf, + struct stat *postbuf); typedef int32_t (*fop_ftruncate_cbk_t) (call_frame_t *frame, void *cookie, xlator_t *this, int32_t op_ret, int32_t op_errno, - struct stat *buf); + struct stat *prebuf, + struct stat *postbuf); typedef int32_t (*fop_utimens_cbk_t) (call_frame_t *frame, void *cookie, @@ -248,7 +251,8 @@ typedef int32_t (*fop_readlink_cbk_t) (call_frame_t *frame, xlator_t *this, int32_t op_ret, int32_t op_errno, - const char *path); + const char *path, + struct stat *buf); typedef int32_t (*fop_mknod_cbk_t) (call_frame_t *frame, void *cookie, @@ -256,7 +260,9 @@ typedef int32_t (*fop_mknod_cbk_t) (call_frame_t *frame, int32_t op_ret, int32_t op_errno, inode_t *inode, - struct stat *buf); + struct stat *buf, + struct stat *preparent, + struct stat *postparent); typedef int32_t (*fop_mkdir_cbk_t) (call_frame_t *frame, void *cookie, @@ -264,19 +270,25 @@ typedef int32_t (*fop_mkdir_cbk_t) (call_frame_t *frame, int32_t op_ret, int32_t op_errno, inode_t *inode, - struct stat *buf); + struct stat *buf, + struct stat *preparent, + struct stat *postparent); typedef int32_t (*fop_unlink_cbk_t) (call_frame_t *frame, void *cookie, xlator_t *this, int32_t op_ret, - int32_t op_errno); + int32_t op_errno, + struct stat *preparent, + struct stat *postparent); typedef int32_t (*fop_rmdir_cbk_t) (call_frame_t *frame, void *cookie, xlator_t *this, int32_t op_ret, - int32_t op_errno); + int32_t op_errno, + struct stat *preparent, + struct stat *postparent); typedef int32_t (*fop_symlink_cbk_t) (call_frame_t *frame, void *cookie, @@ -284,14 +296,20 @@ typedef int32_t (*fop_symlink_cbk_t) (call_frame_t *frame, int32_t op_ret, int32_t op_errno, inode_t *inode, - struct stat *buf); + struct stat *buf, + struct stat *preparent, + struct stat *postparent); typedef int32_t (*fop_rename_cbk_t) (call_frame_t *frame, void *cookie, xlator_t *this, int32_t op_ret, int32_t op_errno, - struct stat *buf); + struct stat *buf, + struct stat *preoldparent, + struct stat *postoldparent, + struct stat *prenewparent, + struct stat *postnewparent); typedef int32_t (*fop_link_cbk_t) (call_frame_t *frame, void *cookie, @@ -299,7 +317,9 @@ typedef int32_t (*fop_link_cbk_t) (call_frame_t *frame, int32_t op_ret, int32_t op_errno, inode_t *inode, - struct stat *buf); + struct stat *buf, + struct stat *preparent, + struct stat *postparent); typedef int32_t (*fop_create_cbk_t) (call_frame_t *frame, void *cookie, @@ -308,7 +328,9 @@ typedef int32_t (*fop_create_cbk_t) (call_frame_t *frame, int32_t op_errno, fd_t *fd, inode_t *inode, - struct stat *buf); + struct stat *buf, + struct stat *preparent, + struct stat *postparent); typedef int32_t (*fop_open_cbk_t) (call_frame_t *frame, void *cookie, @@ -332,7 +354,8 @@ typedef int32_t (*fop_writev_cbk_t) (call_frame_t *frame, xlator_t *this, int32_t op_ret, int32_t op_errno, - struct stat *stbuf); + struct stat *prebuf, + struct stat *postbuf); typedef int32_t (*fop_flush_cbk_t) (call_frame_t *frame, void *cookie, @@ -344,7 +367,9 @@ typedef int32_t (*fop_fsync_cbk_t) (call_frame_t *frame, void *cookie, xlator_t *this, int32_t op_ret, - int32_t op_errno); + int32_t op_errno, + struct stat *prebuf, + struct stat *postbuf); typedef int32_t (*fop_opendir_cbk_t) (call_frame_t *frame, void *cookie, @@ -593,11 +618,21 @@ typedef int32_t (*fop_create_t) (call_frame_t *frame, mode_t mode, fd_t *fd); +/* Tell subsequent writes on the fd_t to fsync after every writev fop without + * requiring a fsync fop. + */ +#define GF_OPEN_FSYNC 0x01 + +/* Tell write-behind to disable writing behind despite O_SYNC not being set. + */ +#define GF_OPEN_NOWB 0x02 + typedef int32_t (*fop_open_t) (call_frame_t *frame, xlator_t *this, loc_t *loc, int32_t flags, - fd_t *fd); + fd_t *fd, + int32_t wbflags); typedef int32_t (*fop_readv_t) (call_frame_t *frame, xlator_t *this, diff --git a/libglusterfsclient/src/libglusterfsclient.c b/libglusterfsclient/src/libglusterfsclient.c index 8649b743b49..96154e40887 100755 --- a/libglusterfsclient/src/libglusterfsclient.c +++ b/libglusterfsclient/src/libglusterfsclient.c @@ -1888,7 +1888,8 @@ libgf_client_lookup_cbk (call_frame_t *frame, int32_t op_errno, inode_t *inode, struct stat *buf, - dict_t *dict) + dict_t *dict, + struct stat *postparent) { libgf_client_local_t *local = frame->local; libglusterfs_client_ctx_t *ctx = frame->root->state; @@ -1959,7 +1960,7 @@ libgf_client_lookup_cbk (call_frame_t *frame, out: local->reply_stub = fop_lookup_cbk_stub (frame, NULL, op_ret, op_errno, - inode, buf, dict); + inode, buf, dict, postparent); LIBGF_REPLY_NOTIFY (local); return 0; @@ -2150,7 +2151,8 @@ libgf_client_lookup_async_cbk (call_frame_t *frame, int32_t op_errno, inode_t *inode, struct stat *stbuf, - dict_t *dict) + dict_t *dict, + struct stat *postparent) { libglusterfs_client_async_local_t *local = frame->local; glusterfs_get_cbk_t lookup_cbk = local->fop.lookup_cbk.cbk; @@ -2651,7 +2653,7 @@ libgf_client_open (libglusterfs_client_ctx_t *ctx, int32_t op_ret = 0; libgf_client_local_t *local = NULL; - LIBGF_CLIENT_FOP (ctx, stub, open, local, loc, flags, fd); + LIBGF_CLIENT_FOP (ctx, stub, open, local, loc, flags, fd, 0); op_ret = stub->args.open_cbk.op_ret; errno = stub->args.open_cbk.op_errno; @@ -2672,12 +2674,15 @@ libgf_client_create_cbk (call_frame_t *frame, int32_t op_errno, fd_t *fd, inode_t *inode, - struct stat *buf) + struct stat *buf, + struct stat *preparent, + struct stat *postparent) { libgf_client_local_t *local = frame->local; local->reply_stub = fop_create_cbk_stub (frame, NULL, op_ret, op_errno, - fd, inode, buf); + fd, inode, buf, preparent, + postparent); LIBGF_REPLY_NOTIFY (local); return 0; @@ -3752,12 +3757,13 @@ libgf_client_writev_cbk (call_frame_t *frame, xlator_t *this, int32_t op_ret, int32_t op_errno, - struct stat *stbuf) + struct stat *prebuf, + struct stat *postbuf) { libgf_client_local_t *local = frame->local; local->reply_stub = fop_writev_cbk_stub (frame, NULL, op_ret, op_errno, - stbuf); + prebuf, postbuf); LIBGF_REPLY_NOTIFY (local); return 0; @@ -4353,7 +4359,8 @@ libglusterfs_writev_async_cbk (call_frame_t *frame, xlator_t *this, int32_t op_ret, int32_t op_errno, - struct stat *stbuf) + struct stat *prebuf, + struct stat *postbuf) { libglusterfs_client_async_local_t *local = frame->local; fd_t *fd = NULL; @@ -4867,12 +4874,15 @@ libgf_client_mkdir_cbk (call_frame_t *frame, int32_t op_ret, int32_t op_errno, inode_t *inode, - struct stat *buf) + struct stat *buf, + struct stat *preparent, + struct stat *postparent) { libgf_client_local_t *local = frame->local; local->reply_stub = fop_mkdir_cbk_stub (frame, NULL, op_ret, op_errno, - inode, buf); + inode, buf, preparent, + postparent); LIBGF_REPLY_NOTIFY (local); return 0; @@ -5000,11 +5010,13 @@ out: static int32_t libgf_client_rmdir_cbk (call_frame_t *frame, void *cookie, xlator_t *this, - int32_t op_ret, int32_t op_errno) + int32_t op_ret, int32_t op_errno,struct stat *preparent, + struct stat *postparent) { libgf_client_local_t *local = frame->local; - local->reply_stub = fop_rmdir_cbk_stub (frame, NULL, op_ret, op_errno); + local->reply_stub = fop_rmdir_cbk_stub (frame, NULL, op_ret, op_errno, + preparent, postparent); LIBGF_REPLY_NOTIFY (local); return 0; @@ -5609,11 +5621,13 @@ out: int libgf_client_fsync_cbk (call_frame_t *frame, void *cookie, xlator_t *xlator, - int32_t op_ret, int32_t op_errno) + int32_t op_ret, int32_t op_errno, struct stat *prebuf, + struct stat *postbuf) { libgf_client_local_t *local = frame->local; - local->reply_stub = fop_fsync_cbk_stub (frame, NULL, op_ret, op_errno); + local->reply_stub = fop_fsync_cbk_stub (frame, NULL, op_ret, op_errno, + prebuf, postbuf); LIBGF_REPLY_NOTIFY (local); @@ -5663,12 +5677,12 @@ out: int libgf_client_ftruncate_cbk (call_frame_t *frame, void *cookie, xlator_t *xlator ,int32_t op_ret, int32_t op_errno, - struct stat *buf) + struct stat *prebuf, struct stat *postbuf) { libgf_client_local_t *local = frame->local; local->reply_stub = fop_ftruncate_cbk_stub (frame, NULL, op_ret, - op_errno, buf); + op_errno, prebuf, postbuf); LIBGF_REPLY_NOTIFY (local); @@ -5698,9 +5712,9 @@ libgf_client_ftruncate (libglusterfs_client_ctx_t *ctx, fd_t *fd, if (op_ret == -1) goto out; - libgf_transform_devnum (ctx, &stub->args.ftruncate_cbk.buf); + libgf_transform_devnum (ctx, &stub->args.ftruncate_cbk.postbuf); libgf_update_iattr_cache (fd->inode, LIBGF_UPDATE_STAT, - &stub->args.ftruncate_cbk.buf); + &stub->args.ftruncate_cbk.postbuf); fdctx = libgf_get_fd_ctx (fd); if (!fd) { @@ -5711,7 +5725,7 @@ libgf_client_ftruncate (libglusterfs_client_ctx_t *ctx, fd_t *fd, pthread_mutex_lock (&fdctx->lock); { - fdctx->offset = stub->args.ftruncate_cbk.buf.st_size; + fdctx->offset = stub->args.ftruncate_cbk.postbuf.st_size; } pthread_mutex_unlock (&fdctx->lock); @@ -5744,12 +5758,14 @@ out: int libgf_client_link_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int32_t op_ret, int32_t op_errno, - inode_t *inode, struct stat *buf) + inode_t *inode, struct stat *buf, + struct stat *preparent, struct stat *postparent) { libgf_client_local_t *local = frame->local; local->reply_stub = fop_link_cbk_stub (frame, NULL, op_ret, op_errno, - inode, buf); + inode, buf, preparent, + postparent); LIBGF_REPLY_NOTIFY (local); @@ -6121,13 +6137,16 @@ out: int32_t libgf_client_rename_cbk (call_frame_t *frame, void *cookie, xlator_t *this, - int32_t op_ret, int32_t op_errno, - struct stat *buf) + int32_t op_ret, int32_t op_errno, struct stat *buf, + struct stat *preoldparent, struct stat *postoldparent, + struct stat *prenewparent, struct stat *postnewparent) { libgf_client_local_t *local = frame->local; local->reply_stub = fop_rename_cbk_stub (frame, NULL, op_ret, op_errno, - buf); + buf, preoldparent, + postoldparent, prenewparent, + postnewparent); LIBGF_REPLY_NOTIFY (local); return 0; @@ -6477,12 +6496,14 @@ out: static int32_t libgf_client_mknod_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int32_t op_ret, int32_t op_errno, - inode_t *inode, struct stat *buf) + inode_t *inode, struct stat *buf, + struct stat *preparent, struct stat *postparent) { libgf_client_local_t *local = frame->local; local->reply_stub = fop_mknod_cbk_stub (frame, NULL, op_ret, op_errno, - inode, buf); + inode, buf, preparent, + postparent); LIBGF_REPLY_NOTIFY (local); return 0; @@ -6681,12 +6702,13 @@ out: int32_t libgf_client_unlink_cbk (call_frame_t *frame, void *cookie, xlator_t *this, - int32_t op_ret, int32_t op_errno) + int32_t op_ret, int32_t op_errno, + struct stat *preparent, struct stat *postparent) { libgf_client_local_t *local = frame->local; - local->reply_stub = fop_unlink_cbk_stub (frame, NULL, op_ret, - op_errno); + local->reply_stub = fop_unlink_cbk_stub (frame, NULL, op_ret, op_errno, + preparent, postparent); LIBGF_REPLY_NOTIFY (local); return 0; @@ -6787,12 +6809,14 @@ out: static int32_t libgf_client_symlink_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int32_t op_ret, int32_t op_errno, - inode_t *inode, struct stat *buf) + inode_t *inode, struct stat *buf, + struct stat *preparent, struct stat *postparent) { libgf_client_local_t *local = frame->local; local->reply_stub = fop_symlink_cbk_stub (frame, NULL, op_ret, - op_errno, inode, buf); + op_errno, inode, buf, + preparent, postparent); LIBGF_REPLY_NOTIFY (local); return 0; @@ -6928,12 +6952,12 @@ out: int32_t libgf_client_readlink_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int32_t op_ret, int32_t op_errno, - const char *path) + const char *path, struct stat *sbuf) { libgf_client_local_t *local = frame->local; local->reply_stub = fop_readlink_cbk_stub (frame, NULL, op_ret, - op_errno, path); + op_errno, path, sbuf); LIBGF_REPLY_NOTIFY (local); return 0; diff --git a/xlators/cluster/afr/src/afr-dir-write.c b/xlators/cluster/afr/src/afr-dir-write.c index 51629234f88..5cd05b13864 100644 --- a/xlators/cluster/afr/src/afr-dir-write.c +++ b/xlators/cluster/afr/src/afr-dir-write.c @@ -115,7 +115,8 @@ afr_create_unwind (call_frame_t *frame, xlator_t *this) int afr_create_wind_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int32_t op_ret, int32_t op_errno, - fd_t *fd, inode_t *inode, struct stat *buf) + fd_t *fd, inode_t *inode, struct stat *buf, + struct stat *preparent, struct stat *postparent) { afr_local_t * local = NULL; afr_private_t * priv = NULL; @@ -366,9 +367,10 @@ afr_mknod_unwind (call_frame_t *frame, xlator_t *this) int -afr_mknod_wind_cbk (call_frame_t *frame, void *cookie, xlator_t *this, - int32_t op_ret, int32_t op_errno, - inode_t *inode, struct stat *buf) +afr_mknod_wind_cbk (call_frame_t *frame, void *cookie, xlator_t *this, + int32_t op_ret, int32_t op_errno, inode_t *inode, + struct stat *buf, struct stat *preparent, + struct stat *postparent) { afr_local_t * local = NULL; afr_private_t * priv = NULL; @@ -601,9 +603,10 @@ afr_mkdir_unwind (call_frame_t *frame, xlator_t *this) int -afr_mkdir_wind_cbk (call_frame_t *frame, void *cookie, xlator_t *this, - int32_t op_ret, int32_t op_errno, - inode_t *inode, struct stat *buf) +afr_mkdir_wind_cbk (call_frame_t *frame, void *cookie, xlator_t *this, + int32_t op_ret, int32_t op_errno, inode_t *inode, + struct stat *buf, struct stat *preparent, + struct stat *postparent) { afr_local_t * local = NULL; afr_private_t * priv = NULL; @@ -840,7 +843,8 @@ afr_link_unwind (call_frame_t *frame, xlator_t *this) int afr_link_wind_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int32_t op_ret, int32_t op_errno, inode_t *inode, - struct stat *buf) + struct stat *buf, struct stat *preparent, + struct stat *postparent) { afr_local_t * local = NULL; afr_private_t * priv = NULL; @@ -1065,7 +1069,8 @@ afr_symlink_unwind (call_frame_t *frame, xlator_t *this) int afr_symlink_wind_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int32_t op_ret, int32_t op_errno, inode_t *inode, - struct stat *buf) + struct stat *buf, struct stat *preparent, + struct stat *postparent) { afr_local_t * local = NULL; afr_private_t * priv = NULL; @@ -1297,7 +1302,9 @@ afr_rename_unwind (call_frame_t *frame, xlator_t *this) int afr_rename_wind_cbk (call_frame_t *frame, void *cookie, xlator_t *this, - int32_t op_ret, int32_t op_errno, struct stat *buf) + int32_t op_ret, int32_t op_errno, struct stat *buf, + struct stat *preoldparent, struct stat *postoldparent, + struct stat *prenewparent, struct stat *postnewparent) { afr_local_t * local = NULL; afr_private_t * priv = NULL; @@ -1496,7 +1503,8 @@ afr_unlink_unwind (call_frame_t *frame, xlator_t *this) int afr_unlink_wind_cbk (call_frame_t *frame, void *cookie, xlator_t *this, - int32_t op_ret, int32_t op_errno) + int32_t op_ret, int32_t op_errno, struct stat *preparent, + struct stat *postparent) { afr_local_t * local = NULL; afr_private_t * priv = NULL; @@ -1683,7 +1691,8 @@ afr_rmdir_unwind (call_frame_t *frame, xlator_t *this) int afr_rmdir_wind_cbk (call_frame_t *frame, void *cookie, xlator_t *this, - int32_t op_ret, int32_t op_errno) + int32_t op_ret, int32_t op_errno, struct stat *preparent, + struct stat *postparent) { afr_local_t * local = NULL; afr_private_t * priv = NULL; diff --git a/xlators/cluster/afr/src/afr-inode-read.c b/xlators/cluster/afr/src/afr-inode-read.c index 2032065119a..8c0431f5a51 100644 --- a/xlators/cluster/afr/src/afr-inode-read.c +++ b/xlators/cluster/afr/src/afr-inode-read.c @@ -428,7 +428,7 @@ out: int32_t afr_readlink_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int32_t op_ret, int32_t op_errno, - const char *buf) + const char *buf, struct stat *sbuf) { afr_private_t * priv = NULL; afr_local_t * local = NULL; diff --git a/xlators/cluster/afr/src/afr-inode-write.c b/xlators/cluster/afr/src/afr-inode-write.c index 591f7cd49aa..601913a0fca 100644 --- a/xlators/cluster/afr/src/afr-inode-write.c +++ b/xlators/cluster/afr/src/afr-inode-write.c @@ -88,7 +88,8 @@ afr_writev_unwind (call_frame_t *frame, xlator_t *this) int afr_writev_wind_cbk (call_frame_t *frame, void *cookie, xlator_t *this, - int32_t op_ret, int32_t op_errno, struct stat *buf) + int32_t op_ret, int32_t op_errno, struct stat *prebuf, + struct stat *postbuf) { afr_local_t * local = NULL; afr_private_t * priv = NULL; @@ -115,11 +116,11 @@ afr_writev_wind_cbk (call_frame_t *frame, void *cookie, xlator_t *this, if (op_ret != -1) { if (local->success_count == 0) { local->op_ret = op_ret; - local->cont.writev.buf = *buf; + local->cont.writev.buf = *postbuf; } if (child_index == read_child) { - local->cont.writev.read_child_buf = *buf; + local->cont.writev.read_child_buf = *postbuf; } local->success_count++; @@ -323,7 +324,8 @@ afr_truncate_unwind (call_frame_t *frame, xlator_t *this) int afr_truncate_wind_cbk (call_frame_t *frame, void *cookie, xlator_t *this, - int32_t op_ret, int32_t op_errno, struct stat *buf) + int32_t op_ret, int32_t op_errno, struct stat *prebuf, + struct stat *postbuf) { afr_local_t * local = NULL; afr_private_t * priv = NULL; @@ -350,11 +352,11 @@ afr_truncate_wind_cbk (call_frame_t *frame, void *cookie, xlator_t *this, if (op_ret != -1) { if (local->success_count == 0) { local->op_ret = op_ret; - local->cont.truncate.buf = *buf; + local->cont.truncate.buf = *postbuf; } if (child_index == read_child) { - local->cont.truncate.read_child_buf = *buf; + local->cont.truncate.read_child_buf = *postbuf; } local->success_count++; @@ -543,7 +545,8 @@ afr_ftruncate_unwind (call_frame_t *frame, xlator_t *this) int afr_ftruncate_wind_cbk (call_frame_t *frame, void *cookie, xlator_t *this, - int32_t op_ret, int32_t op_errno, struct stat *buf) + int32_t op_ret, int32_t op_errno, struct stat *prebuf, + struct stat *postbuf) { afr_local_t * local = NULL; afr_private_t * priv = NULL; @@ -570,11 +573,11 @@ afr_ftruncate_wind_cbk (call_frame_t *frame, void *cookie, xlator_t *this, if (op_ret != -1) { if (local->success_count == 0) { local->op_ret = op_ret; - local->cont.ftruncate.buf = *buf; + local->cont.ftruncate.buf = *postbuf; } if (child_index == read_child) { - local->cont.ftruncate.read_child_buf = *buf; + local->cont.ftruncate.read_child_buf = *postbuf; } local->success_count++; diff --git a/xlators/cluster/afr/src/afr-self-heal-algorithm.c b/xlators/cluster/afr/src/afr-self-heal-algorithm.c index 46d451913b0..5197f6be43f 100644 --- a/xlators/cluster/afr/src/afr-self-heal-algorithm.c +++ b/xlators/cluster/afr/src/afr-self-heal-algorithm.c @@ -55,7 +55,8 @@ sh_full_read_write_iter (call_frame_t *frame, xlator_t *this); static int sh_full_write_cbk (call_frame_t *frame, void *cookie, xlator_t *this, - int32_t op_ret, int32_t op_errno, struct stat *buf) + int32_t op_ret, int32_t op_errno, struct stat *prebuf, + struct stat *postbuf) { afr_private_t * priv = NULL; afr_local_t * local = NULL; @@ -281,7 +282,8 @@ sh_diff_iter (call_frame_t *frame, xlator_t *this); static int sh_diff_write_cbk (call_frame_t *frame, void *cookie, xlator_t *this, - int32_t op_ret, int32_t op_errno, struct stat *buf) + int32_t op_ret, int32_t op_errno, struct stat *buf, + struct stat *postbuf) { afr_private_t * priv = NULL; afr_local_t * local = NULL; diff --git a/xlators/cluster/afr/src/afr-self-heal-common.c b/xlators/cluster/afr/src/afr-self-heal-common.c index 4a260ed903e..ef25204a11a 100644 --- a/xlators/cluster/afr/src/afr-self-heal-common.c +++ b/xlators/cluster/afr/src/afr-self-heal-common.c @@ -831,7 +831,9 @@ static int sh_missing_entries_newentry_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int32_t op_ret, int32_t op_errno, - inode_t *inode, struct stat *buf) + inode_t *inode, struct stat *buf, + struct stat *preparent, + struct stat *postparent) { afr_local_t *local = NULL; afr_self_heal_t *sh = NULL; @@ -1044,7 +1046,7 @@ static int sh_missing_entries_readlink_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int32_t op_ret, int32_t op_errno, - const char *link) + const char *link, struct stat *sbuf) { if (op_ret > 0) sh_missing_entries_symlink (frame, this, link); @@ -1164,7 +1166,8 @@ static int sh_missing_entries_lookup_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int32_t op_ret, int32_t op_errno, - inode_t *inode, struct stat *buf, dict_t *xattr) + inode_t *inode, struct stat *buf, dict_t *xattr, + struct stat *postparent) { int child_index = 0; afr_local_t *local = NULL; diff --git a/xlators/cluster/afr/src/afr-self-heal-data.c b/xlators/cluster/afr/src/afr-self-heal-data.c index 576a15e06f2..5300f0a7528 100644 --- a/xlators/cluster/afr/src/afr-self-heal-data.c +++ b/xlators/cluster/afr/src/afr-self-heal-data.c @@ -395,7 +395,8 @@ afr_sh_data_erase_pending (call_frame_t *frame, xlator_t *this) int afr_sh_data_trim_cbk (call_frame_t *frame, void *cookie, xlator_t *this, - int32_t op_ret, int32_t op_errno, struct stat *buf) + int32_t op_ret, int32_t op_errno, struct stat *prebuf, + struct stat *postbuf) { afr_private_t * priv = NULL; afr_local_t * local = NULL; @@ -600,7 +601,7 @@ afr_sh_data_open (call_frame_t *frame, xlator_t *this) (void *) (long) source, priv->children[source], priv->children[source]->fops->open, - &local->loc, O_RDWR|O_LARGEFILE, fd); + &local->loc, O_RDWR|O_LARGEFILE, fd, 0); call_count--; /* open sinks */ @@ -613,7 +614,7 @@ afr_sh_data_open (call_frame_t *frame, xlator_t *this) priv->children[i], priv->children[i]->fops->open, &local->loc, - O_RDWR|O_LARGEFILE, fd); + O_RDWR|O_LARGEFILE, fd, 0); if (!--call_count) break; @@ -758,7 +759,8 @@ afr_sh_data_fix (call_frame_t *frame, xlator_t *this) int afr_sh_data_lookup_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int32_t op_ret, int32_t op_errno, - inode_t *inode, struct stat *buf, dict_t *xattr) + inode_t *inode, struct stat *buf, dict_t *xattr, + struct stat *postparent) { afr_private_t *priv = NULL; afr_local_t *local = NULL; diff --git a/xlators/cluster/afr/src/afr-self-heal-entry.c b/xlators/cluster/afr/src/afr-self-heal-entry.c index b3bb6720917..fa938415864 100644 --- a/xlators/cluster/afr/src/afr-self-heal-entry.c +++ b/xlators/cluster/afr/src/afr-self-heal-entry.c @@ -426,7 +426,9 @@ afr_sh_entry_expunge_entry_done (call_frame_t *frame, xlator_t *this, int afr_sh_entry_expunge_remove_cbk (call_frame_t *expunge_frame, void *cookie, xlator_t *this, - int32_t op_ret, int32_t op_errno) + int32_t op_ret, int32_t op_errno, + struct stat *preparent, + struct stat *postparent) { afr_private_t *priv = NULL; afr_local_t *expunge_local = NULL; @@ -564,7 +566,8 @@ int afr_sh_entry_expunge_lookup_cbk (call_frame_t *expunge_frame, void *cookie, xlator_t *this, int32_t op_ret, int32_t op_errno, - inode_t *inode, struct stat *buf, dict_t *x) + inode_t *inode, struct stat *buf, dict_t *x, + struct stat *postparent) { afr_private_t *priv = NULL; afr_local_t *expunge_local = NULL; @@ -626,7 +629,8 @@ int afr_sh_entry_expunge_entry_cbk (call_frame_t *expunge_frame, void *cookie, xlator_t *this, int32_t op_ret, int32_t op_errno, - inode_t *inode, struct stat *buf, dict_t *x) + inode_t *inode, struct stat *buf, dict_t *x, + struct stat *postparent) { afr_private_t *priv = NULL; afr_local_t *expunge_local = NULL; @@ -1021,7 +1025,9 @@ int afr_sh_entry_impunge_newfile_cbk (call_frame_t *impunge_frame, void *cookie, xlator_t *this, int32_t op_ret, int32_t op_errno, - inode_t *inode, struct stat *stbuf) + inode_t *inode, struct stat *stbuf, + struct stat *preparent, + struct stat *postparent) { int call_count = 0; afr_private_t *priv = NULL; @@ -1188,7 +1194,7 @@ int afr_sh_entry_impunge_readlink_cbk (call_frame_t *impunge_frame, void *cookie, xlator_t *this, int32_t op_ret, int32_t op_errno, - const char *linkname) + const char *linkname, struct stat *sbuf) { afr_private_t *priv = NULL; afr_local_t *impunge_local = NULL; @@ -1264,7 +1270,7 @@ afr_sh_entry_impunge_recreate_lookup_cbk (call_frame_t *impunge_frame, void *cookie, xlator_t *this, int32_t op_ret, int32_t op_errno, inode_t *inode, struct stat *buf, - dict_t *xattr) + dict_t *xattr,struct stat *postparent) { afr_private_t *priv = NULL; afr_local_t *impunge_local = NULL; @@ -1372,7 +1378,8 @@ int afr_sh_entry_impunge_entry_cbk (call_frame_t *impunge_frame, void *cookie, xlator_t *this, int32_t op_ret, int32_t op_errno, - inode_t *inode, struct stat *buf, dict_t *x) + inode_t *inode, struct stat *buf, dict_t *x, + struct stat *postparent) { afr_private_t *priv = NULL; afr_local_t *impunge_local = NULL; @@ -1861,7 +1868,8 @@ afr_sh_entry_fix (call_frame_t *frame, xlator_t *this) int afr_sh_entry_lookup_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int32_t op_ret, int32_t op_errno, - inode_t *inode, struct stat *buf, dict_t *xattr) + inode_t *inode, struct stat *buf, dict_t *xattr, + struct stat *postparent) { afr_private_t *priv = NULL; afr_local_t *local = NULL; diff --git a/xlators/cluster/afr/src/afr-self-heal-metadata.c b/xlators/cluster/afr/src/afr-self-heal-metadata.c index 686446b5f30..9a02ab6ddb3 100644 --- a/xlators/cluster/afr/src/afr-self-heal-metadata.c +++ b/xlators/cluster/afr/src/afr-self-heal-metadata.c @@ -591,7 +591,8 @@ afr_sh_metadata_fix (call_frame_t *frame, xlator_t *this) int afr_sh_metadata_lookup_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int32_t op_ret, int32_t op_errno, - inode_t *inode, struct stat *buf, dict_t *xattr) + inode_t *inode, struct stat *buf, dict_t *xattr, + struct stat *postparent) { afr_local_t *local = NULL; afr_self_heal_t *sh = NULL; diff --git a/xlators/cluster/afr/src/afr.c b/xlators/cluster/afr/src/afr.c index ef93e5078a2..b65a4dc466d 100644 --- a/xlators/cluster/afr/src/afr.c +++ b/xlators/cluster/afr/src/afr.c @@ -448,7 +448,8 @@ afr_self_heal_cbk (call_frame_t *frame, xlator_t *this) int afr_lookup_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int32_t op_ret, int32_t op_errno, - inode_t *inode, struct stat *buf, dict_t *xattr) + inode_t *inode, struct stat *buf, dict_t *xattr, + struct stat *postparent) { afr_local_t * local = NULL; afr_private_t * priv = NULL; @@ -789,7 +790,8 @@ out: int afr_open_ftruncate_cbk (call_frame_t *frame, void *cookie, xlator_t *this, - int32_t op_ret, int32_t op_errno, struct stat *buf) + int32_t op_ret, int32_t op_errno, struct stat *prebuf, + struct stat *postbuf) { afr_local_t * local = frame->local; int ret = 0; @@ -864,8 +866,8 @@ afr_open_cbk (call_frame_t *frame, void *cookie, int -afr_open (call_frame_t *frame, xlator_t *this, - loc_t *loc, int32_t flags, fd_t *fd) +afr_open (call_frame_t *frame, xlator_t *this, loc_t *loc, int32_t flags, + fd_t *fd, int32_t wbflags) { afr_private_t * priv = NULL; afr_local_t * local = NULL; @@ -910,7 +912,7 @@ afr_open (call_frame_t *frame, xlator_t *this, STACK_WIND_COOKIE (frame, afr_open_cbk, (void *) (long) i, priv->children[i], priv->children[i]->fops->open, - loc, wind_flags, fd); + loc, wind_flags, fd, wbflags); if (!--call_count) break; @@ -1152,8 +1154,9 @@ out: /* {{{ fsync */ int -afr_fsync_cbk (call_frame_t *frame, void *cookie, - xlator_t *this, int32_t op_ret, int32_t op_errno) +afr_fsync_cbk (call_frame_t *frame, void *cookie, xlator_t *this, + int32_t op_ret, int32_t op_errno, struct stat *prebuf, + struct stat *postbuf) { afr_local_t *local = NULL; @@ -1294,7 +1297,7 @@ afr_fsyncdir (call_frame_t *frame, xlator_t *this, fd_t *fd, for (i = 0; i < priv->child_count; i++) { if (local->child_up[i]) { - STACK_WIND (frame, afr_fsync_cbk, + STACK_WIND (frame, afr_fsyncdir_cbk, priv->children[i], priv->children[i]->fops->fsyncdir, fd, datasync); diff --git a/xlators/cluster/dht/src/dht-common.c b/xlators/cluster/dht/src/dht-common.c index d5d6f4c3e2f..49af12101b7 100644 --- a/xlators/cluster/dht/src/dht-common.c +++ b/xlators/cluster/dht/src/dht-common.c @@ -79,7 +79,8 @@ dht_lookup_selfheal_cbk (call_frame_t *frame, void *cookie, int dht_lookup_dir_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int op_ret, int op_errno, - inode_t *inode, struct stat *stbuf, dict_t *xattr) + inode_t *inode, struct stat *stbuf, dict_t *xattr, + struct stat *postparent) { dht_conf_t *conf = NULL; dht_local_t *local = NULL; @@ -190,7 +191,8 @@ selfheal: int dht_revalidate_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int op_ret, int op_errno, - inode_t *inode, struct stat *stbuf, dict_t *xattr) + inode_t *inode, struct stat *stbuf, dict_t *xattr, + struct stat *postparent) { dht_local_t *local = NULL; int this_call_cnt = 0; @@ -308,7 +310,8 @@ int dht_lookup_linkfile_create_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int32_t op_ret, int32_t op_errno, - inode_t *inode, struct stat *stbuf) + inode_t *inode, struct stat *stbuf, + struct stat *preparent, struct stat *postparent) { dht_local_t *local = NULL; xlator_t *cached_subvol = NULL; @@ -345,7 +348,8 @@ unwind: int dht_lookup_everywhere_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int32_t op_ret, int32_t op_errno, - inode_t *inode, struct stat *buf, dict_t *xattr) + inode_t *inode, struct stat *buf, dict_t *xattr, + struct stat *postparent) { dht_conf_t *conf = NULL; dht_local_t *local = NULL; @@ -521,7 +525,8 @@ dht_lookup_everywhere (call_frame_t *frame, xlator_t *this, loc_t *loc) int dht_lookup_linkfile_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int op_ret, int op_errno, - inode_t *inode, struct stat *stbuf, dict_t *xattr) + inode_t *inode, struct stat *stbuf, dict_t *xattr, + struct stat *postparent) { call_frame_t *prev = NULL; dht_local_t *local = NULL; @@ -622,7 +627,8 @@ dht_lookup_directory (call_frame_t *frame, xlator_t *this, loc_t *loc) int dht_lookup_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int op_ret, int op_errno, - inode_t *inode, struct stat *stbuf, dict_t *xattr) + inode_t *inode, struct stat *stbuf, dict_t *xattr, + struct stat *postparent) { dht_layout_t *layout = NULL; char is_linkfile = 0; @@ -853,6 +859,48 @@ err: int +dht_truncate_cbk (call_frame_t *frame, void *cookie, xlator_t *this, + int op_ret, int op_errno, struct stat *prebuf, + struct stat *postbuf) +{ + dht_local_t *local = NULL; + int this_call_cnt = 0; + call_frame_t *prev = NULL; + + + local = frame->local; + prev = cookie; + + LOCK (&frame->lock); + { + if (op_ret == -1) { + local->op_errno = op_errno; + gf_log (this->name, GF_LOG_DEBUG, + "subvolume %s returned -1 (%s)", + prev->this->name, strerror (op_errno)); + goto unlock; + } + + dht_stat_merge (this, &local->stbuf, prebuf, prev->this); + + if (local->inode) + local->stbuf.st_ino = local->inode->ino; + local->op_ret = 0; + } +unlock: + UNLOCK (&frame->lock); + + this_call_cnt = dht_frame_return (frame); + if (is_last_call (this_call_cnt)) + DHT_STACK_UNWIND (frame, local->op_ret, local->op_errno, + &local->stbuf); + + return 0; +} + + + +int dht_attr_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int op_ret, int op_errno, struct stat *stbuf) { @@ -1031,7 +1079,7 @@ dht_truncate (call_frame_t *frame, xlator_t *this, local->inode = inode_ref (loc->inode); local->call_cnt = 1; - STACK_WIND (frame, dht_attr_cbk, + STACK_WIND (frame, dht_truncate_cbk, subvol, subvol->fops->truncate, loc, offset); @@ -1077,7 +1125,7 @@ dht_ftruncate (call_frame_t *frame, xlator_t *this, local->inode = inode_ref (fd->inode); local->call_cnt = 1; - STACK_WIND (frame, dht_attr_cbk, + STACK_WIND (frame, dht_truncate_cbk, subvol, subvol->fops->ftruncate, fd, offset); @@ -1092,6 +1140,78 @@ err: int +dht_unlink_cbk (call_frame_t *frame, void *cookie, xlator_t *this, + int op_ret, int op_errno, struct stat *preparent, + struct stat *postparent) +{ + dht_local_t *local = NULL; + int this_call_cnt = 0; + call_frame_t *prev = NULL; + + + local = frame->local; + prev = cookie; + + LOCK (&frame->lock); + { + if (op_ret == -1) { + local->op_errno = op_errno; + gf_log (this->name, GF_LOG_DEBUG, + "subvolume %s returned -1 (%s)", + prev->this->name, strerror (op_errno)); + goto unlock; + } + + local->op_ret = 0; + } +unlock: + UNLOCK (&frame->lock); + + this_call_cnt = dht_frame_return (frame); + if (is_last_call (this_call_cnt)) + DHT_STACK_UNWIND (frame, local->op_ret, local->op_errno); + + return 0; +} + + +int +dht_fsync_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int op_ret, + int op_errno, struct stat *prebuf, struct stat *postbuf) +{ + dht_local_t *local = NULL; + int this_call_cnt = 0; + call_frame_t *prev = NULL; + + + local = frame->local; + prev = cookie; + + LOCK (&frame->lock); + { + if (op_ret == -1) { + local->op_errno = op_errno; + gf_log (this->name, GF_LOG_DEBUG, + "subvolume %s returned -1 (%s)", + prev->this->name, strerror (op_errno)); + goto unlock; + } + + local->op_ret = 0; + } +unlock: + UNLOCK (&frame->lock); + + this_call_cnt = dht_frame_return (frame); + if (is_last_call (this_call_cnt)) + DHT_STACK_UNWIND (frame, local->op_ret, local->op_errno); + + return 0; +} + + + +int dht_err_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int op_ret, int op_errno) { @@ -1175,9 +1295,9 @@ err: int dht_readlink_cbk (call_frame_t *frame, void *cookie, xlator_t *this, - int op_ret, int op_errno, const char *path) + int op_ret, int op_errno, const char *path, struct stat *sbuf) { - DHT_STACK_UNWIND (frame, op_ret, op_errno, path); + DHT_STACK_UNWIND (frame, op_ret, op_errno, path, sbuf); return 0; } @@ -1397,7 +1517,7 @@ unlock: int dht_open (call_frame_t *frame, xlator_t *this, - loc_t *loc, int flags, fd_t *fd) + loc_t *loc, int flags, fd_t *fd, int wbflags) { xlator_t *subvol = NULL; int ret = -1; @@ -1438,7 +1558,7 @@ dht_open (call_frame_t *frame, xlator_t *this, STACK_WIND (frame, dht_fd_cbk, subvol, subvol->fops->open, - loc, flags, fd); + loc, flags, fd, wbflags); return 0; @@ -1499,9 +1619,10 @@ err: int dht_writev_cbk (call_frame_t *frame, void *cookie, xlator_t *this, - int op_ret, int op_errno, struct stat *stbuf) + int op_ret, int op_errno, struct stat *prebuf, + struct stat *postbuf) { - DHT_STACK_UNWIND (frame, op_ret, op_errno, stbuf); + DHT_STACK_UNWIND (frame, op_ret, op_errno, prebuf, postbuf); return 0; } @@ -1616,7 +1737,7 @@ dht_fsync (call_frame_t *frame, xlator_t *this, } local->call_cnt = 1; - STACK_WIND (frame, dht_err_cbk, + STACK_WIND (frame, dht_fsync_cbk, subvol, subvol->fops->fsync, fd, datasync); @@ -2010,7 +2131,8 @@ err: int dht_newfile_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int op_ret, int op_errno, - inode_t *inode, struct stat *stbuf) + inode_t *inode, struct stat *stbuf, struct stat *preparent, + struct stat *postparent) { call_frame_t *prev = NULL; dht_layout_t *layout = NULL; @@ -2052,7 +2174,8 @@ int dht_mknod_linkfile_create_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int32_t op_ret, int32_t op_errno, - inode_t *inode, struct stat *stbuf) + inode_t *inode, struct stat *stbuf, + struct stat *preparent, struct stat *postparent) { dht_local_t *local = NULL; xlator_t *cached_subvol = NULL; @@ -2235,11 +2358,11 @@ dht_unlink (call_frame_t *frame, xlator_t *this, loc_t *loc) if (hashed_subvol != cached_subvol) local->call_cnt++; - STACK_WIND (frame, dht_err_cbk, + STACK_WIND (frame, dht_unlink_cbk, cached_subvol, cached_subvol->fops->unlink, loc); if (hashed_subvol != cached_subvol) - STACK_WIND (frame, dht_err_cbk, + STACK_WIND (frame, dht_unlink_cbk, hashed_subvol, hashed_subvol->fops->unlink, loc); return 0; @@ -2255,7 +2378,8 @@ err: int dht_link_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int op_ret, int op_errno, - inode_t *inode, struct stat *stbuf) + inode_t *inode, struct stat *stbuf, struct stat *preparent, + struct stat *postparent) { call_frame_t *prev = NULL; dht_layout_t *layout = NULL; @@ -2289,7 +2413,8 @@ out: int dht_link_linkfile_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int op_ret, int op_errno, - inode_t *inode, struct stat *stbuf) + inode_t *inode, struct stat *stbuf, + struct stat *preparent, struct stat *postparent) { dht_local_t *local = NULL; xlator_t *srcvol = NULL; @@ -2393,7 +2518,8 @@ err: int dht_create_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int op_ret, int op_errno, - fd_t *fd, inode_t *inode, struct stat *stbuf) + fd_t *fd, inode_t *inode, struct stat *stbuf, + struct stat *preparent, struct stat *postparent) { call_frame_t *prev = NULL; dht_layout_t *layout = NULL; @@ -2435,7 +2561,8 @@ int dht_create_linkfile_create_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int32_t op_ret, int32_t op_errno, - inode_t *inode, struct stat *stbuf) + inode_t *inode, struct stat *stbuf, + struct stat *preparent, struct stat *postparent) { dht_local_t *local = NULL; xlator_t *cached_subvol = NULL; @@ -2570,7 +2697,8 @@ dht_mkdir_selfheal_cbk (call_frame_t *frame, void *cookie, int dht_mkdir_cbk (call_frame_t *frame, void *cookie, xlator_t *this, - int op_ret, int op_errno, inode_t *inode, struct stat *stbuf) + int op_ret, int op_errno, inode_t *inode, struct stat *stbuf, + struct stat *preparent, struct stat *postparent) { dht_local_t *local = NULL; int this_call_cnt = 0; @@ -2618,8 +2746,9 @@ unlock: int dht_mkdir_hashed_cbk (call_frame_t *frame, void *cookie, - xlator_t *this, int op_ret, int op_errno, - inode_t *inode, struct stat *stbuf) + xlator_t *this, int op_ret, int op_errno, + inode_t *inode, struct stat *stbuf, + struct stat *preparent, struct stat *postparent) { dht_local_t *local = NULL; int ret = -1; @@ -2764,7 +2893,8 @@ dht_rmdir_selfheal_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int dht_rmdir_cbk (call_frame_t *frame, void *cookie, xlator_t *this, - int op_ret, int op_errno) + int op_ret, int op_errno, struct stat *preparent, + struct stat *postparent) { uint64_t tmp_layout = 0; dht_local_t *local = NULL; diff --git a/xlators/cluster/dht/src/dht-linkfile.c b/xlators/cluster/dht/src/dht-linkfile.c index 213d3f2bf72..d28f7beca09 100644 --- a/xlators/cluster/dht/src/dht-linkfile.c +++ b/xlators/cluster/dht/src/dht-linkfile.c @@ -40,7 +40,7 @@ dht_linkfile_xattr_cbk (call_frame_t *frame, void *cookie, xlator_t *this, local = frame->local; local->linkfile.linkfile_cbk (frame, cookie, this, op_ret, op_errno, local->linkfile.inode, - &local->linkfile.stbuf); + &local->linkfile.stbuf, NULL, NULL); return 0; } @@ -48,8 +48,9 @@ dht_linkfile_xattr_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int dht_linkfile_create_cbk (call_frame_t *frame, void *cookie, xlator_t *this, - int op_ret, int op_errno, - inode_t *inode, struct stat *stbuf) + int op_ret, int op_errno, inode_t *inode, + struct stat *stbuf, struct stat *preparent, + struct stat *postparent) { dht_local_t *local = NULL; call_frame_t *prev = NULL; @@ -104,8 +105,8 @@ err: str_data = NULL; } - local->linkfile.linkfile_cbk (frame, cookie, this, - op_ret, op_errno, inode, stbuf); + local->linkfile.linkfile_cbk (frame, cookie, this, op_ret, op_errno, + inode, stbuf, preparent, postparent); return 0; } @@ -132,7 +133,8 @@ dht_linkfile_create (call_frame_t *frame, fop_mknod_cbk_t linkfile_cbk, int dht_linkfile_unlink_cbk (call_frame_t *frame, void *cookie, xlator_t *this, - int32_t op_ret, int32_t op_errno) + int32_t op_ret, int32_t op_errno, + struct stat *preparent, struct stat *postparent) { dht_local_t *local = NULL; call_frame_t *prev = NULL; diff --git a/xlators/cluster/dht/src/dht-rename.c b/xlators/cluster/dht/src/dht-rename.c index 6c34dabad1e..f91d1983d69 100644 --- a/xlators/cluster/dht/src/dht-rename.c +++ b/xlators/cluster/dht/src/dht-rename.c @@ -33,7 +33,9 @@ int dht_rename_dir_cbk (call_frame_t *frame, void *cookie, xlator_t *this, - int32_t op_ret, int32_t op_errno, struct stat *stbuf) + int32_t op_ret, int32_t op_errno, struct stat *stbuf, + struct stat *preoldparent, struct stat *postoldparent, + struct stat *prenewparent, struct stat *postnewparent) { dht_local_t *local = NULL; int this_call_cnt = 0; @@ -213,7 +215,8 @@ err: int dht_rename_unlink_cbk (call_frame_t *frame, void *cookie, xlator_t *this, - int32_t op_ret, int32_t op_errno) + int32_t op_ret, int32_t op_errno, struct stat *preparent, + struct stat *postparent) { dht_local_t *local = NULL; call_frame_t *prev = NULL; @@ -240,7 +243,9 @@ dht_rename_unlink_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int dht_rename_cbk (call_frame_t *frame, void *cookie, xlator_t *this, - int32_t op_ret, int32_t op_errno, struct stat *stbuf) + int32_t op_ret, int32_t op_errno, struct stat *stbuf, + struct stat *preoldparent, struct stat *postoldparent, + struct stat *prenewparent, struct stat *postnewparent) { dht_local_t *local = NULL; call_frame_t *prev = NULL; @@ -369,7 +374,8 @@ dht_do_rename (call_frame_t *frame) int dht_rename_links_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int32_t op_ret, int32_t op_errno, - inode_t *inode, struct stat *stbuf) + inode_t *inode, struct stat *stbuf, + struct stat *preparent, struct stat *postparent) { dht_local_t *local = NULL; call_frame_t *prev = NULL; diff --git a/xlators/cluster/dht/src/dht-selfheal.c b/xlators/cluster/dht/src/dht-selfheal.c index df8b2047b2b..d3b36363ee3 100644 --- a/xlators/cluster/dht/src/dht-selfheal.c +++ b/xlators/cluster/dht/src/dht-selfheal.c @@ -196,7 +196,8 @@ dht_selfheal_dir_xattr (call_frame_t *frame, loc_t *loc, dht_layout_t *layout) int dht_selfheal_dir_mkdir_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int op_ret, int op_errno, - inode_t *inode, struct stat *stbuf) + inode_t *inode, struct stat *stbuf, + struct stat *preparent, struct stat *postparent) { dht_local_t *local = NULL; dht_layout_t *layout = NULL; diff --git a/xlators/cluster/dht/src/nufa.c b/xlators/cluster/dht/src/nufa.c index 6be7206bfb5..17516a122c3 100644 --- a/xlators/cluster/dht/src/nufa.c +++ b/xlators/cluster/dht/src/nufa.c @@ -30,7 +30,8 @@ int nufa_local_lookup_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int op_ret, int op_errno, - inode_t *inode, struct stat *stbuf, dict_t *xattr) + inode_t *inode, struct stat *stbuf, dict_t *xattr, + struct stat *postparent) { dht_layout_t *layout = NULL; xlator_t *subvol = NULL; @@ -268,7 +269,9 @@ err: int nufa_create_linkfile_create_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int op_ret, int op_errno, - inode_t *inode, struct stat *stbuf) + inode_t *inode, struct stat *stbuf, + struct stat *preparent, + struct stat *postparent) { dht_local_t *local = NULL; call_frame_t *prev = NULL; @@ -374,8 +377,9 @@ err: int nufa_mknod_linkfile_cbk (call_frame_t *frame, void *cookie, xlator_t *this, - int op_ret, int op_errno, - inode_t *inode, struct stat *stbuf) + int op_ret, int op_errno, inode_t *inode, + struct stat *stbuf, struct stat *preparent, + struct stat *postparent) { dht_local_t *local = NULL; call_frame_t *prev = NULL; diff --git a/xlators/cluster/ha/src/ha.c b/xlators/cluster/ha/src/ha.c index b380cb1e9a7..b2ca48b1089 100644 --- a/xlators/cluster/ha/src/ha.c +++ b/xlators/cluster/ha/src/ha.c @@ -64,7 +64,8 @@ ha_lookup_cbk (call_frame_t *frame, int32_t op_errno, inode_t *inode, struct stat *buf, - dict_t *dict) + dict_t *dict, + struct stat *postparent) { ha_local_t *local = NULL; ha_private_t *pvt = NULL; @@ -307,7 +308,8 @@ ha_truncate_cbk (call_frame_t *frame, xlator_t *this, int32_t op_ret, int32_t op_errno, - struct stat *buf) + struct stat *prebuf, + struct stat *postbuf) { int ret = -1; @@ -316,7 +318,8 @@ ha_truncate_cbk (call_frame_t *frame, STACK_UNWIND (frame, op_ret, op_errno, - buf); + prebuf, + postbuf); } return 0; } @@ -357,7 +360,8 @@ ha_ftruncate_cbk (call_frame_t *frame, xlator_t *this, int32_t op_ret, int32_t op_errno, - struct stat *buf) + struct stat *prebuf, + struct stat *postbuf) { int ret = -1; @@ -367,7 +371,7 @@ ha_ftruncate_cbk (call_frame_t *frame, STACK_UNWIND (frame, op_ret, op_errno, - buf); + prebuf, postbuf); } return 0; } @@ -458,7 +462,8 @@ ha_readlink_cbk (call_frame_t *frame, xlator_t *this, int32_t op_ret, int32_t op_errno, - const char *path) + const char *path, + struct stat *sbuf) { int ret = -1; @@ -468,7 +473,8 @@ ha_readlink_cbk (call_frame_t *frame, STACK_UNWIND (frame, op_ret, op_errno, - path); + path, + sbuf); } return 0; } @@ -511,7 +517,8 @@ ha_mknod_lookup_cbk (call_frame_t *frame, int32_t op_errno, inode_t *inode, struct stat *buf, - dict_t *dict) + dict_t *dict, + struct stat *postparent) { ha_local_t *local = NULL; ha_private_t *pvt = NULL; @@ -573,7 +580,9 @@ ha_mknod_cbk (call_frame_t *frame, int32_t op_ret, int32_t op_errno, inode_t *inode, - struct stat *buf) + struct stat *buf, + struct stat *preparent, + struct stat *postparent) { ha_local_t *local = NULL; ha_private_t *pvt = NULL; @@ -708,7 +717,8 @@ ha_mkdir_lookup_cbk (call_frame_t *frame, int32_t op_errno, inode_t *inode, struct stat *buf, - dict_t *dict) + dict_t *dict, + struct stat *postparent) { ha_local_t *local = NULL; ha_private_t *pvt = NULL; @@ -762,7 +772,9 @@ ha_mkdir_cbk (call_frame_t *frame, int32_t op_ret, int32_t op_errno, inode_t *inode, - struct stat *buf) + struct stat *buf, + struct stat *preparent, + struct stat *postparent) { ha_local_t *local = NULL; ha_private_t *pvt = NULL; @@ -886,7 +898,9 @@ ha_unlink_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int32_t op_ret, - int32_t op_errno) + int32_t op_errno, + struct stat *preparent, + struct stat *postparent) { int ret = -1; @@ -931,7 +945,9 @@ ha_rmdir_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int32_t op_ret, - int32_t op_errno) + int32_t op_errno, + struct stat *preparent, + struct stat *postparent) { int ret = -1; @@ -982,7 +998,8 @@ ha_symlink_lookup_cbk (call_frame_t *frame, int32_t op_errno, inode_t *inode, struct stat *buf, - dict_t *dict) + dict_t *dict, + struct stat *postparent) { ha_local_t *local = NULL; ha_private_t *pvt = NULL; @@ -1036,7 +1053,9 @@ ha_symlink_cbk (call_frame_t *frame, int32_t op_ret, int32_t op_errno, inode_t *inode, - struct stat *buf) + struct stat *buf, + struct stat *preparent, + struct stat *postparent) { ha_local_t *local = NULL; ha_private_t *pvt = NULL; @@ -1163,7 +1182,11 @@ ha_rename_cbk (call_frame_t *frame, xlator_t *this, int32_t op_ret, int32_t op_errno, - struct stat *buf) + struct stat *buf, + struct stat *preoldparent, + struct stat *postoldparent, + struct stat *prenewparent, + struct stat *postnewparent) { int ret = -1; @@ -1211,7 +1234,8 @@ ha_link_lookup_cbk (call_frame_t *frame, int32_t op_errno, inode_t *inode, struct stat *buf, - dict_t *dict) + dict_t *dict, + struct stat *postparent) { ha_local_t *local = NULL; ha_private_t *pvt = NULL; @@ -1265,7 +1289,9 @@ ha_link_cbk (call_frame_t *frame, int32_t op_ret, int32_t op_errno, inode_t *inode, - struct stat *buf) + struct stat *buf, + struct stat *preparent, + struct stat *postparent) { ha_local_t *local = NULL; ha_private_t *pvt = NULL; @@ -1405,7 +1431,9 @@ ha_create_cbk (call_frame_t *frame, int32_t op_errno, fd_t *fd, inode_t *inode, - struct stat *buf) + struct stat *buf, + struct stat *preparent, + struct stat *postparent) { ha_local_t *local = NULL; ha_private_t *pvt = NULL; @@ -1602,7 +1630,7 @@ int32_t ha_open (call_frame_t *frame, xlator_t *this, loc_t *loc, - int32_t flags, fd_t *fd) + int32_t flags, fd_t *fd, int wbflags) { ha_local_t *local = NULL; ha_private_t *pvt = NULL; @@ -1646,7 +1674,7 @@ ha_open (call_frame_t *frame, ha_open_cbk, children[i], children[i]->fops->open, - loc, flags, fd); + loc, flags, fd, wbflags); if (--cnt == 0) break; } @@ -1719,7 +1747,8 @@ ha_writev_cbk (call_frame_t *frame, xlator_t *this, int32_t op_ret, int32_t op_errno, - struct stat *stbuf) + struct stat *prebuf, + struct stat *postbuf) { int ret = 0; ret = ha_handle_cbk (frame, cookie, op_ret, op_errno); @@ -1728,7 +1757,8 @@ ha_writev_cbk (call_frame_t *frame, STACK_UNWIND (frame, op_ret, op_errno, - stbuf); + prebuf, + postbuf); } return 0; } @@ -1820,7 +1850,9 @@ ha_fsync_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int32_t op_ret, - int32_t op_errno) + int32_t op_errno, + struct stat *prebuf, + struct stat *postbuf) { int ret = 0; ret = ha_handle_cbk (frame, cookie, op_ret, op_errno); diff --git a/xlators/cluster/map/src/map.c b/xlators/cluster/map/src/map.c index 3eb49e2eddc..91cf8eb24a1 100644 --- a/xlators/cluster/map/src/map.c +++ b/xlators/cluster/map/src/map.c @@ -92,14 +92,15 @@ map_truncate_cbk (call_frame_t *frame, xlator_t *this, int32_t op_ret, int32_t op_errno, - struct stat *buf) + struct stat *prebuf, + struct stat *postbuf) { call_frame_t *prev = NULL; prev = cookie; - map_itransform (this, prev->this, buf->st_ino, &buf->st_ino); + map_itransform (this, prev->this, postbuf->st_ino, &postbuf->st_ino); - STACK_UNWIND (frame, op_ret, op_errno, buf); + STACK_UNWIND (frame, op_ret, op_errno, prebuf, postbuf); return 0; } @@ -109,14 +110,15 @@ map_ftruncate_cbk (call_frame_t *frame, xlator_t *this, int32_t op_ret, int32_t op_errno, - struct stat *buf) + struct stat *prebuf, + struct stat *postbuf) { call_frame_t *prev = NULL; prev = cookie; - map_itransform (this, prev->this, buf->st_ino, &buf->st_ino); + map_itransform (this, prev->this, postbuf->st_ino, &postbuf->st_ino); - STACK_UNWIND (frame, op_ret, op_errno, buf); + STACK_UNWIND (frame, op_ret, op_errno, prebuf, postbuf); return 0; } @@ -138,9 +140,10 @@ map_readlink_cbk (call_frame_t *frame, xlator_t *this, int32_t op_ret, int32_t op_errno, - const char *path) + const char *path, + struct stat *sbuf) { - STACK_UNWIND (frame, op_ret, op_errno, path); + STACK_UNWIND (frame, op_ret, op_errno, path, sbuf); return 0; } @@ -149,9 +152,11 @@ map_unlink_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int32_t op_ret, - int32_t op_errno) + int32_t op_errno, + struct stat *preparent, + struct stat *postparent) { - STACK_UNWIND (frame, op_ret, op_errno); + STACK_UNWIND (frame, op_ret, op_errno, preparent, postparent); return 0; } @@ -160,9 +165,11 @@ map_rmdir_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int32_t op_ret, - int32_t op_errno) + int32_t op_errno, + struct stat *preparent, + struct stat *postparent) { - STACK_UNWIND (frame, op_ret, op_errno); + STACK_UNWIND (frame, op_ret, op_errno, preparent, postparent); return 0; } @@ -173,7 +180,11 @@ map_rename_cbk (call_frame_t *frame, xlator_t *this, int32_t op_ret, int32_t op_errno, - struct stat *buf) + struct stat *buf, + struct stat *preoldparent, + struct stat *postoldparent, + struct stat *prenewparent, + struct stat *postnewparent) { call_frame_t *prev = NULL; prev = cookie; @@ -191,7 +202,9 @@ map_link_cbk (call_frame_t *frame, int32_t op_ret, int32_t op_errno, inode_t *inode, - struct stat *buf) + struct stat *buf, + struct stat *preparent, + struct stat *postparent) { call_frame_t *prev = NULL; prev = cookie; @@ -240,14 +253,15 @@ map_writev_cbk (call_frame_t *frame, xlator_t *this, int32_t op_ret, int32_t op_errno, - struct stat *stbuf) + struct stat *prebuf, + struct stat *postbuf) { call_frame_t *prev = NULL; prev = cookie; - map_itransform (this, prev->this, stbuf->st_ino, &stbuf->st_ino); + map_itransform (this, prev->this, postbuf->st_ino, &postbuf->st_ino); - STACK_UNWIND (frame, op_ret, op_errno, stbuf); + STACK_UNWIND (frame, op_ret, op_errno, prebuf, postbuf); return 0; } @@ -268,9 +282,11 @@ map_fsync_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int32_t op_ret, - int32_t op_errno) + int32_t op_errno, + struct stat *prebuf, + struct stat *postbuf) { - STACK_UNWIND (frame, op_ret, op_errno); + STACK_UNWIND (frame, op_ret, op_errno, prebuf, postbuf); return 0; } @@ -476,7 +492,9 @@ map_newentry_cbk (call_frame_t *frame, int32_t op_ret, int32_t op_errno, inode_t *inode, - struct stat *buf) + struct stat *buf, + struct stat *preparent, + struct stat *postparent) { call_frame_t *prev = NULL; prev = cookie; @@ -497,7 +515,9 @@ map_create_cbk (call_frame_t *frame, int32_t op_errno, fd_t *fd, inode_t *inode, - struct stat *buf) + struct stat *buf, + struct stat *preparent, + struct stat *postparent) { call_frame_t *prev = NULL; prev = cookie; @@ -605,7 +625,8 @@ map_single_lookup_cbk (call_frame_t *frame, int32_t op_errno, inode_t *inode, struct stat *buf, - dict_t *dict) + dict_t *dict, + struct stat *postparent) { call_frame_t *prev = NULL; prev = cookie; @@ -625,7 +646,8 @@ map_root_lookup_cbk (call_frame_t *frame, int32_t op_errno, inode_t *inode, struct stat *buf, - dict_t *dict) + dict_t *dict, + struct stat *postparent) { int callcnt = 0; map_local_t *local = NULL; @@ -1210,7 +1232,7 @@ int32_t map_open (call_frame_t *frame, xlator_t *this, loc_t *loc, - int32_t flags, fd_t *fd) + int32_t flags, fd_t *fd, int wbflags) { int32_t op_errno = 1; xlator_t *subvol = NULL; @@ -1228,7 +1250,7 @@ map_open (call_frame_t *frame, } STACK_WIND (frame, map_open_cbk, subvol, - subvol->fops->open, loc, flags, fd); + subvol->fops->open, loc, flags, fd, wbflags); return 0; err: diff --git a/xlators/cluster/stripe/src/stripe.c b/xlators/cluster/stripe/src/stripe.c index 5a02d17bc2e..2d875ab3e2f 100644 --- a/xlators/cluster/stripe/src/stripe.c +++ b/xlators/cluster/stripe/src/stripe.c @@ -70,6 +70,19 @@ stripe_get_matching_bs (const char *path, struct stripe_options *opts, /* + * stripe_common_remove_cbk - + */ +int32_t +stripe_common_remove_cbk (call_frame_t *frame, void *cookie, xlator_t *this, + int32_t op_ret, int32_t op_errno, + struct stat *preparent, struct stat *postparent) +{ + STACK_UNWIND (frame, op_ret, op_errno, preparent, postparent); + return 0; +} + + +/* * stripe_common_cbk - */ int32_t @@ -127,6 +140,169 @@ stripe_stack_unwind_cbk (call_frame_t *frame, void *cookie, xlator_t *this, return 0; } + +int32_t +stripe_fsync_cbk (call_frame_t *frame, void *cookie, xlator_t *this, + int32_t op_ret, int32_t op_errno, struct stat *prebuf, + struct stat *postbuf) +{ + int32_t callcnt = 0; + stripe_local_t *local = NULL; + + local = frame->local; + + LOCK (&frame->lock); + { + callcnt = --local->call_count; + + if (op_ret == -1) { + gf_log (this->name, GF_LOG_DEBUG, + "%s returned %s", + ((call_frame_t *)cookie)->this->name, + strerror (op_errno)); + local->op_errno = op_errno; + if (op_errno == ENOTCONN) + local->failed = 1; + } + if (op_ret >= 0) + local->op_ret = op_ret; + } + UNLOCK (&frame->lock); + + if (!callcnt) { + if (local->failed) + local->op_ret = -1; + + if (local->loc.path) + loc_wipe (&local->loc); + if (local->loc2.path) + loc_wipe (&local->loc2); + + STACK_UNWIND (frame, local->op_ret, local->op_errno); + } + return 0; +} + + + +/** + * stripe_stack_unwind_remove_cbk - This function is used for unlink + * _cbk without any extra arguments (other than the minimum given) + * This is called from functions like fsync,unlink,rmdir etc. + * + */ +int32_t +stripe_stack_unwind_unlink_cbk (call_frame_t *frame, void *cookie, + xlator_t *this, int32_t op_ret, + int32_t op_errno, struct stat *preparent, + struct stat *postparent) +{ + int32_t callcnt = 0; + stripe_local_t *local = NULL; + + local = frame->local; + + LOCK (&frame->lock); + { + callcnt = --local->call_count; + + if (op_ret == -1) { + gf_log (this->name, GF_LOG_DEBUG, + "%s returned %s", + ((call_frame_t *)cookie)->this->name, + strerror (op_errno)); + local->op_errno = op_errno; + if (op_errno == ENOTCONN) + local->failed = 1; + } + if (op_ret >= 0) + local->op_ret = op_ret; + } + UNLOCK (&frame->lock); + + if (!callcnt) { + if (local->failed) + local->op_ret = -1; + + if (local->loc.path) + loc_wipe (&local->loc); + if (local->loc2.path) + loc_wipe (&local->loc2); + + STACK_UNWIND (frame, local->op_ret, local->op_errno); + } + return 0; +} + + +int32_t +stripe_truncate_cbk (call_frame_t *frame, void *cookie, xlator_t *this, + int32_t op_ret, int32_t op_errno, struct stat *prebuf, + struct stat *postbuf) +{ + int32_t callcnt = 0; + stripe_local_t *local = NULL; + + local = frame->local; + + LOCK (&frame->lock); + { + callcnt = --local->call_count; + + if (op_ret == -1) { + gf_log (this->name, GF_LOG_DEBUG, + "%s returned error %s", + ((call_frame_t *)cookie)->this->name, + strerror (op_errno)); + local->op_errno = op_errno; + if (op_errno == ENOTCONN) + local->failed = 1; + } + + if (op_ret == 0) { + local->op_ret = 0; + if (local->stbuf.st_blksize == 0) { + local->stbuf = *postbuf; + /* Because st_blocks gets added again */ + local->stbuf.st_blocks = 0; + } + + if (FIRST_CHILD(this) == + ((call_frame_t *)cookie)->this) { + /* Always, pass the inode number of + first child to the above layer */ + local->stbuf.st_ino = postbuf->st_ino; + local->stbuf.st_mtime = postbuf->st_mtime; + } + + local->stbuf.st_blocks += postbuf->st_blocks; + if (local->stbuf.st_size < postbuf->st_size) + local->stbuf.st_size = postbuf->st_size; + if (local->stbuf.st_blksize != postbuf->st_blksize) { + /* TODO: add to blocks in terms of + original block size */ + } + } + } + UNLOCK (&frame->lock); + + if (!callcnt) { + if (local->failed) + local->op_ret = -1; + + if (local->loc.path) + loc_wipe (&local->loc); + if (local->loc2.path) + loc_wipe (&local->loc2); + + STACK_UNWIND (frame, local->op_ret, local->op_errno, + &local->stbuf); + } + + return 0; +} + + int32_t stripe_common_buf_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int32_t op_ret, int32_t op_errno, struct stat *buf) @@ -135,6 +311,76 @@ stripe_common_buf_cbk (call_frame_t *frame, void *cookie, xlator_t *this, return 0; } + +int32_t +stripe_stack_rename_cbk (call_frame_t *frame, void *cookie, xlator_t *this, + int32_t op_ret, int32_t op_errno, struct stat *buf, + struct stat *preoldparent, struct stat *postoldparent, + struct stat *prenewparent, struct stat *postnewparent) +{ + int32_t callcnt = 0; + stripe_local_t *local = NULL; + + local = frame->local; + + LOCK (&frame->lock); + { + callcnt = --local->call_count; + + if (op_ret == -1) { + gf_log (this->name, GF_LOG_DEBUG, + "%s returned error %s", + ((call_frame_t *)cookie)->this->name, + strerror (op_errno)); + local->op_errno = op_errno; + if (op_errno == ENOTCONN) + local->failed = 1; + } + + if (op_ret == 0) { + local->op_ret = 0; + if (local->stbuf.st_blksize == 0) { + local->stbuf = *buf; + /* Because st_blocks gets added again */ + local->stbuf.st_blocks = 0; + } + + if (FIRST_CHILD(this) == + ((call_frame_t *)cookie)->this) { + /* Always, pass the inode number of + first child to the above layer */ + local->stbuf.st_ino = buf->st_ino; + local->stbuf.st_mtime = buf->st_mtime; + } + + local->stbuf.st_blocks += buf->st_blocks; + if (local->stbuf.st_size < buf->st_size) + local->stbuf.st_size = buf->st_size; + if (local->stbuf.st_blksize != buf->st_blksize) { + /* TODO: add to blocks in terms of + original block size */ + } + } + } + UNLOCK (&frame->lock); + + if (!callcnt) { + if (local->failed) + local->op_ret = -1; + + if (local->loc.path) + loc_wipe (&local->loc); + if (local->loc2.path) + loc_wipe (&local->loc2); + + STACK_UNWIND (frame, local->op_ret, local->op_errno, + &local->stbuf); + } + + return 0; +} + + /** * stripe_stack_unwind_buf_cbk - This function is used for all the _cbk with * 'struct stat *buf' as extra argument (other than minimum) @@ -214,9 +460,11 @@ stripe_stack_unwind_buf_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int32_t stripe_common_inode_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int32_t op_ret, int32_t op_errno, inode_t *inode, - struct stat *buf) + struct stat *buf, struct stat *preparent, + struct stat *postparent) { - STACK_UNWIND (frame, op_ret, op_errno, inode, buf); + STACK_UNWIND (frame, op_ret, op_errno, inode, buf, preparent, + postparent); return 0; } @@ -232,7 +480,8 @@ int32_t stripe_stack_unwind_inode_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int32_t op_ret, int32_t op_errno, inode_t *inode, - struct stat *buf) + struct stat *buf, struct stat *preparent, + struct stat *postparent) { int32_t callcnt = 0; stripe_local_t *local = NULL; @@ -293,7 +542,7 @@ stripe_stack_unwind_inode_cbk (call_frame_t *frame, void *cookie, int32_t stripe_lookup_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int32_t op_ret, int32_t op_errno, inode_t *inode, - struct stat *buf, dict_t *dict) + struct stat *buf, dict_t *dict, struct stat *postparent) { int32_t callcnt = 0; dict_t *tmp_dict = NULL; @@ -611,7 +860,7 @@ stripe_truncate (call_frame_t *frame, xlator_t *this, loc_t *loc, off_t offset) send_fop_to_all = 1; if (!send_fop_to_all) { - STACK_WIND (frame, stripe_common_buf_cbk, trav->xlator, + STACK_WIND (frame, stripe_truncate_cbk, trav->xlator, trav->xlator->fops->truncate, loc, offset); } else { /* Initialization */ @@ -626,7 +875,7 @@ stripe_truncate (call_frame_t *frame, xlator_t *this, loc_t *loc, off_t offset) local->call_count = priv->child_count; while (trav) { - STACK_WIND (frame, stripe_stack_unwind_buf_cbk, + STACK_WIND (frame, stripe_truncate_cbk, trav->xlator, trav->xlator->fops->truncate, loc, offset); trav = trav->next; @@ -822,7 +1071,9 @@ stripe_fsetattr (call_frame_t *frame, xlator_t *this, fd_t *fd, int32_t stripe_first_rename_cbk (call_frame_t *frame, void *cookie, xlator_t *this, - int32_t op_ret, int32_t op_errno, struct stat *buf) + int32_t op_ret, int32_t op_errno, struct stat *buf, + struct stat *preoldparent, struct stat *postoldparent, + struct stat *prenewparent, struct stat *postnewparent) { stripe_local_t *local = NULL; xlator_list_t *trav = NULL; @@ -840,7 +1091,7 @@ stripe_first_rename_cbk (call_frame_t *frame, void *cookie, xlator_t *this, trav = trav->next; /* Skip first child */ while (trav) { - STACK_WIND (frame, stripe_stack_unwind_buf_cbk, + STACK_WIND (frame, stripe_stack_rename_cbk, trav->xlator, trav->xlator->fops->rename, &local->loc, &local->loc2); trav = trav->next; @@ -933,9 +1184,10 @@ stripe_access (call_frame_t *frame, xlator_t *this, loc_t *loc, int32_t mask) */ int32_t stripe_readlink_cbk (call_frame_t *frame, void *cookie, xlator_t *this, - int32_t op_ret, int32_t op_errno, const char *path) + int32_t op_ret, int32_t op_errno, const char *path, + struct stat *sbuf) { - STACK_UNWIND (frame, op_ret, op_errno, path); + STACK_UNWIND (frame, op_ret, op_errno, path, sbuf); return 0; } @@ -994,7 +1246,7 @@ stripe_unlink (call_frame_t *frame, xlator_t *this, loc_t *loc) send_fop_to_all = 1; if (!send_fop_to_all) { - STACK_WIND (frame, stripe_common_cbk, trav->xlator, + STACK_WIND (frame, stripe_common_remove_cbk, trav->xlator, trav->xlator->fops->unlink, loc); } else { /* Don't unlink a file if a node is down */ @@ -1014,7 +1266,7 @@ stripe_unlink (call_frame_t *frame, xlator_t *this, loc_t *loc) local->call_count = priv->child_count; while (trav) { - STACK_WIND (frame, stripe_stack_unwind_cbk, + STACK_WIND (frame, stripe_stack_unwind_unlink_cbk, trav->xlator, trav->xlator->fops->unlink, loc); trav = trav->next; @@ -1030,7 +1282,9 @@ stripe_unlink (call_frame_t *frame, xlator_t *this, loc_t *loc) int32_t stripe_first_rmdir_cbk (call_frame_t *frame, void *cookie, xlator_t *this, - int32_t op_ret, int32_t op_errno) + int32_t op_ret, int32_t op_errno,struct stat *preparent, + struct stat *postparent) + { xlator_list_t *trav = NULL; stripe_local_t *local = NULL; @@ -1047,7 +1301,7 @@ stripe_first_rmdir_cbk (call_frame_t *frame, void *cookie, xlator_t *this, trav = trav->next; /* Skip first child */ while (trav) { - STACK_WIND (frame, stripe_stack_unwind_cbk, trav->xlator, + STACK_WIND (frame, stripe_stack_unwind_unlink_cbk, trav->xlator, trav->xlator->fops->rmdir, &local->loc); trav = trav->next; } @@ -1139,7 +1393,8 @@ stripe_setxattr (call_frame_t *frame, xlator_t *this, loc_t *loc, int32_t stripe_mknod_ifreg_fail_unlink_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int32_t op_ret, - int32_t op_errno) + int32_t op_errno, struct stat *preparent, + struct stat *postparent) { int32_t callcnt = 0; stripe_local_t *local = NULL; @@ -1216,7 +1471,8 @@ stripe_mknod_ifreg_setxattr_cbk (call_frame_t *frame, void *cookie, int32_t stripe_mknod_ifreg_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int32_t op_ret, int32_t op_errno, inode_t *inode, - struct stat *buf) + struct stat *buf, struct stat *preparent, + struct stat *postparent) { int ret = 0; int32_t callcnt = 0; @@ -1544,7 +1800,8 @@ stripe_link (call_frame_t *frame, xlator_t *this, loc_t *oldloc, loc_t *newloc) int32_t stripe_create_fail_unlink_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int32_t op_ret, - int32_t op_errno) + int32_t op_errno, struct stat *preparent, + struct stat *postparent) { int32_t callcnt = 0; fd_t *lfd = NULL; @@ -1632,7 +1889,8 @@ stripe_create_setxattr_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int32_t stripe_create_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int32_t op_ret, int32_t op_errno, fd_t *fd, - inode_t *inode, struct stat *buf) + inode_t *inode, struct stat *buf, struct stat *preparent, + struct stat *postparent) { int32_t callcnt = 0; stripe_local_t *local = NULL; @@ -2015,7 +2273,7 @@ stripe_open_getxattr_cbk (call_frame_t *frame, void *cookie, xlator_t *this, while (trav) { STACK_WIND (frame, stripe_open_cbk, trav->xlator, trav->xlator->fops->open, &local->loc, - local->flags, local->fd); + local->flags, local->fd, 0); trav = trav->next; } } @@ -2035,7 +2293,7 @@ stripe_open_getxattr_cbk (call_frame_t *frame, void *cookie, xlator_t *this, */ int32_t stripe_open (call_frame_t *frame, xlator_t *this, loc_t *loc, - int32_t flags, fd_t *fd) + int32_t flags, fd_t *fd, int32_t wbflags) { stripe_local_t *local = NULL; stripe_private_t *priv = NULL; @@ -2100,7 +2358,8 @@ stripe_open (call_frame_t *frame, xlator_t *this, loc_t *loc, while (trav) { STACK_WIND (frame, stripe_open_cbk, trav->xlator, trav->xlator->fops->open, - &local->loc, local->flags, local->fd); + &local->loc, local->flags, local->fd, + wbflags); trav = trav->next; } } @@ -2464,7 +2723,7 @@ stripe_fsync (call_frame_t *frame, xlator_t *this, fd_t *fd, int32_t flags) local->call_count = priv->child_count; while (trav) { - STACK_WIND (frame, stripe_stack_unwind_cbk, trav->xlator, + STACK_WIND (frame, stripe_fsync_cbk, trav->xlator, trav->xlator->fops->fsync, fd, flags); trav = trav->next; } @@ -2552,7 +2811,7 @@ stripe_ftruncate (call_frame_t *frame, xlator_t *this, fd_t *fd, off_t offset) local->call_count = priv->child_count; while (trav) { - STACK_WIND (frame, stripe_stack_unwind_buf_cbk, trav->xlator, + STACK_WIND (frame, stripe_truncate_cbk, trav->xlator, trav->xlator->fops->ftruncate, fd, offset); trav = trav->next; } @@ -2823,7 +3082,8 @@ stripe_readv (call_frame_t *frame, xlator_t *this, fd_t *fd, */ int32_t stripe_writev_cbk (call_frame_t *frame, void *cookie, xlator_t *this, - int32_t op_ret, int32_t op_errno, struct stat *stbuf) + int32_t op_ret, int32_t op_errno, struct stat *prebuf, + struct stat *postbuf) { int32_t callcnt = 0; stripe_local_t *local = NULL; @@ -2844,7 +3104,7 @@ stripe_writev_cbk (call_frame_t *frame, void *cookie, xlator_t *this, } if (op_ret >= 0) { local->op_ret += op_ret; - local->stbuf = *stbuf; + local->stbuf = *postbuf; } } UNLOCK (&frame->lock); diff --git a/xlators/cluster/unify/src/unify.c b/xlators/cluster/unify/src/unify.c index b641fb3307e..80ba10278c1 100644 --- a/xlators/cluster/unify/src/unify.c +++ b/xlators/cluster/unify/src/unify.c @@ -328,7 +328,8 @@ unify_lookup_cbk (call_frame_t *frame, int32_t op_errno, inode_t *inode, struct stat *buf, - dict_t *dict) + dict_t *dict, + struct stat *postparent) { int32_t callcnt = 0; unify_private_t *priv = this->private; @@ -788,7 +789,9 @@ unify_mkdir_cbk (call_frame_t *frame, int32_t op_ret, int32_t op_errno, inode_t *inode, - struct stat *buf) + struct stat *buf, + struct stat *preparent, + struct stat *postparent) { int32_t callcnt = 0; unify_private_t *priv = this->private; @@ -849,7 +852,9 @@ unify_ns_mkdir_cbk (call_frame_t *frame, int32_t op_ret, int32_t op_errno, inode_t *inode, - struct stat *buf) + struct stat *buf, + struct stat *preparent, + struct stat *postparent) { unify_private_t *priv = this->private; unify_local_t *local = frame->local; @@ -928,7 +933,9 @@ unify_rmdir_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int32_t op_ret, - int32_t op_errno) + int32_t op_errno, + struct stat *preparent, + struct stat *postparent) { int32_t callcnt = 0; unify_private_t *priv = this->private; @@ -960,7 +967,9 @@ unify_ns_rmdir_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int32_t op_ret, - int32_t op_errno) + int32_t op_errno, + struct stat *preparent, + struct stat *postparent) { int16_t index = 0; unify_private_t *priv = this->private; @@ -1237,7 +1246,8 @@ unify_open (call_frame_t *frame, xlator_t *this, loc_t *loc, int32_t flags, - fd_t *fd) + fd_t *fd, + int32_t wbflags) { unify_private_t *priv = this->private; unify_local_t *local = NULL; @@ -1305,7 +1315,7 @@ unify_open (call_frame_t *frame, priv->xl_array[file_list[index]]->fops->open, loc, flags, - fd); + fd, wbflags); if (need_break) break; } @@ -1319,7 +1329,9 @@ unify_create_unlink_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int32_t op_ret, - int32_t op_errno) + int32_t op_errno, + struct stat *preparent, + struct stat *postparent) { unify_local_t *local = frame->local; inode_t *inode = local->loc1.inode; @@ -1432,7 +1444,8 @@ unify_create_lookup_cbk (call_frame_t *frame, int32_t op_errno, inode_t *inode, struct stat *buf, - dict_t *dict) + dict_t *dict, + struct stat *postparent) { int32_t callcnt = 0; int16_t index = 0; @@ -1514,7 +1527,7 @@ unify_create_lookup_cbk (call_frame_t *frame, priv->xl_array[file_list[index]]->fops->open, &local->loc1, local->flags, - local->fd); + local->fd, 0); if (need_break) break; } @@ -1535,7 +1548,9 @@ unify_create_cbk (call_frame_t *frame, int32_t op_errno, fd_t *fd, inode_t *inode, - struct stat *buf) + struct stat *buf, + struct stat *preparent, + struct stat *postparent) { int ret = 0; unify_local_t *local = frame->local; @@ -1592,7 +1607,9 @@ unify_ns_create_cbk (call_frame_t *frame, int32_t op_errno, fd_t *fd, inode_t *inode, - struct stat *buf) + struct stat *buf, + struct stat *preparent, + struct stat *postparent) { struct sched_ops *sched_ops = NULL; xlator_t *sched_xl = NULL; @@ -1921,6 +1938,69 @@ unify_fsetattr (call_frame_t *frame, xlator_t *this, fd_t *fd, /** + * unify_ftruncate_cbk - + */ +int32_t +unify_ftruncate_cbk (call_frame_t *frame, void *cookie, xlator_t *this, + int32_t op_ret, int32_t op_errno, struct stat *buf) +{ + int32_t callcnt = 0; + unify_private_t *priv = this->private; + unify_local_t *local = frame->local; + call_frame_t *prev_frame = cookie; + + LOCK (&frame->lock); + { + callcnt = --local->call_count; + + if (op_ret == -1) { + gf_log (this->name, GF_LOG_ERROR, + "child(%s): path(%s): %s", + prev_frame->this->name, + (local->loc1.path)?local->loc1.path:"", + strerror (op_errno)); + local->op_errno = op_errno; + if (!((op_errno == ENOENT) && priv->optimist)) + local->op_ret = -1; + } + + if (op_ret >= 0) { + if (NS (this) == prev_frame->this) { + local->st_ino = buf->st_ino; + /* If the entry is directory, get the + stat from NS node */ + if (S_ISDIR (buf->st_mode) || + !local->stbuf.st_blksize) { + local->stbuf = *buf; + } + } + + if ((!S_ISDIR (buf->st_mode)) && + (NS (this) != prev_frame->this)) { + /* If file, take the stat info from + Storage node. */ + local->stbuf = *buf; + } + } + } + UNLOCK (&frame->lock); + + if (!callcnt) { + if (local->st_ino) + local->stbuf.st_ino = local->st_ino; + else + local->op_ret = -1; + unify_local_wipe (local); + STACK_UNWIND (frame, local->op_ret, local->op_errno, + &local->stbuf); + } + + return 0; +} + + + +/** * unify_truncate_cbk - */ int32_t @@ -1929,7 +2009,8 @@ unify_truncate_cbk (call_frame_t *frame, xlator_t *this, int32_t op_ret, int32_t op_errno, - struct stat *buf) + struct stat *prebuf, + struct stat *postbuf) { int32_t callcnt = 0; unify_private_t *priv = this->private; @@ -1953,20 +2034,20 @@ unify_truncate_cbk (call_frame_t *frame, if (op_ret >= 0) { if (NS (this) == prev_frame->this) { - local->st_ino = buf->st_ino; + local->st_ino = postbuf->st_ino; /* If the entry is directory, get the stat from NS node */ - if (S_ISDIR (buf->st_mode) || + if (S_ISDIR (postbuf->st_mode) || !local->stbuf.st_blksize) { - local->stbuf = *buf; + local->stbuf = *postbuf; } } - if ((!S_ISDIR (buf->st_mode)) && + if ((!S_ISDIR (postbuf->st_mode)) && (NS (this) != prev_frame->this)) { /* If file, take the stat info from Storage node. */ - local->stbuf = *buf; + local->stbuf = *postbuf; } } } @@ -2027,7 +2108,7 @@ unify_truncate (call_frame_t *frame, } /* Don't send truncate to NS node */ - STACK_WIND (frame, unify_truncate_cbk, NS(this), + STACK_WIND (frame, unify_ftruncate_cbk, NS(this), NS(this)->fops->stat, loc); callcnt--; @@ -2057,9 +2138,10 @@ unify_readlink_cbk (call_frame_t *frame, xlator_t *this, int32_t op_ret, int32_t op_errno, - const char *path) + const char *path, + struct stat *sbuf) { - STACK_UNWIND (frame, op_ret, op_errno, path); + STACK_UNWIND (frame, op_ret, op_errno, path, sbuf); return 0; } @@ -2117,7 +2199,9 @@ unify_unlink_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int32_t op_ret, - int32_t op_errno) + int32_t op_errno, + struct stat *preparent, + struct stat *postparent) { int32_t callcnt = 0; unify_private_t *priv = this->private; @@ -2245,9 +2329,10 @@ unify_writev_cbk (call_frame_t *frame, xlator_t *this, int32_t op_ret, int32_t op_errno, - struct stat *stbuf) + struct stat *prebuf, + struct stat *postbuf) { - STACK_UNWIND (frame, op_ret, op_errno, stbuf); + STACK_UNWIND (frame, op_ret, op_errno, prebuf, postbuf); return 0; } @@ -2307,11 +2392,11 @@ unify_ftruncate (call_frame_t *frame, local->call_count = 2; - STACK_WIND (frame, unify_truncate_cbk, + STACK_WIND (frame, unify_truncate_cbk, child, child->fops->ftruncate, fd, offset); - STACK_WIND (frame, unify_truncate_cbk, + STACK_WIND (frame, unify_ftruncate_cbk, NS(this), NS(this)->fops->fstat, fd); @@ -2363,9 +2448,11 @@ unify_fsync_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int32_t op_ret, - int32_t op_errno) + int32_t op_errno, + struct stat *prebuf, + struct stat *postbuf) { - STACK_UNWIND (frame, op_ret, op_errno); + STACK_UNWIND (frame, op_ret, op_errno, prebuf, postbuf); return 0; } @@ -3015,7 +3102,9 @@ unify_mknod_unlink_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int32_t op_ret, - int32_t op_errno) + int32_t op_errno, + struct stat *preparent, + struct stat *postparent) { unify_local_t *local = frame->local; @@ -3039,7 +3128,9 @@ unify_mknod_cbk (call_frame_t *frame, int32_t op_ret, int32_t op_errno, inode_t *inode, - struct stat *buf) + struct stat *buf, + struct stat *preparent, + struct stat *postparent) { unify_local_t *local = frame->local; @@ -3073,7 +3164,9 @@ unify_ns_mknod_cbk (call_frame_t *frame, int32_t op_ret, int32_t op_errno, inode_t *inode, - struct stat *buf) + struct stat *buf, + struct stat *preparent, + struct stat *postparent) { struct sched_ops *sched_ops = NULL; xlator_t *sched_xl = NULL; @@ -3177,7 +3270,9 @@ unify_symlink_unlink_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int32_t op_ret, - int32_t op_errno) + int32_t op_errno, + struct stat *preparent, + struct stat *postparent) { unify_local_t *local = frame->local; if (op_ret == -1) @@ -3199,7 +3294,9 @@ unify_symlink_cbk (call_frame_t *frame, int32_t op_ret, int32_t op_errno, inode_t *inode, - struct stat *buf) + struct stat *buf, + struct stat *preparent, + struct stat *postparent) { unify_local_t *local = frame->local; @@ -3238,7 +3335,9 @@ unify_ns_symlink_cbk (call_frame_t *frame, int32_t op_ret, int32_t op_errno, inode_t *inode, - struct stat *buf) + struct stat *buf, + struct stat *preparent, + struct stat *postparent) { struct sched_ops *sched_ops = NULL; @@ -3347,7 +3446,9 @@ unify_rename_unlink_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int32_t op_ret, - int32_t op_errno) + int32_t op_errno, + struct stat *preparent, + struct stat *postparent) { int32_t callcnt = 0; unify_local_t *local = frame->local; @@ -3382,7 +3483,11 @@ unify_ns_rename_undo_cbk (call_frame_t *frame, xlator_t *this, int32_t op_ret, int32_t op_errno, - struct stat *buf) + struct stat *buf, + struct stat *preoldparent, + struct stat *postoldparent, + struct stat *prenewparent, + struct stat *postnewparent) { unify_local_t *local = frame->local; @@ -3405,7 +3510,11 @@ unify_rename_cbk (call_frame_t *frame, xlator_t *this, int32_t op_ret, int32_t op_errno, - struct stat *buf) + struct stat *buf, + struct stat *preoldparent, + struct stat *postoldparent, + struct stat *prenewparent, + struct stat *postnewparent) { int32_t index = 0; int32_t callcnt = 0; @@ -3561,7 +3670,11 @@ unify_ns_rename_cbk (call_frame_t *frame, xlator_t *this, int32_t op_ret, int32_t op_errno, - struct stat *buf) + struct stat *buf, + struct stat *preoldparent, + struct stat *postoldparent, + struct stat *prenewparent, + struct stat *postnewparent) { int32_t index = 0; int32_t callcnt = 0; @@ -3680,7 +3793,9 @@ unify_link_cbk (call_frame_t *frame, int32_t op_ret, int32_t op_errno, inode_t *inode, - struct stat *buf) + struct stat *buf, + struct stat *preparent, + struct stat *postparent) { unify_local_t *local = frame->local; @@ -3704,7 +3819,9 @@ unify_ns_link_cbk (call_frame_t *frame, int32_t op_ret, int32_t op_errno, inode_t *inode, - struct stat *buf) + struct stat *buf, + struct stat *preparent, + struct stat *postparent) { unify_private_t *priv = this->private; unify_local_t *local = frame->local; diff --git a/xlators/debug/error-gen/src/error-gen.c b/xlators/debug/error-gen/src/error-gen.c index 5aee0af410b..04b4e67b4be 100644 --- a/xlators/debug/error-gen/src/error-gen.c +++ b/xlators/debug/error-gen/src/error-gen.c @@ -52,7 +52,8 @@ error_gen_lookup_cbk (call_frame_t *frame, int32_t op_errno, inode_t *inode, struct stat *buf, - dict_t *dict) + dict_t *dict, + struct stat *postparent) { STACK_UNWIND (frame, op_ret, @@ -197,12 +198,14 @@ error_gen_truncate_cbk (call_frame_t *frame, xlator_t *this, int32_t op_ret, int32_t op_errno, - struct stat *buf) + struct stat *prebuf, + struct stat *postbuf) { STACK_UNWIND (frame, op_ret, op_errno, - buf); + prebuf, + postbuf); return 0; } @@ -234,12 +237,14 @@ error_gen_ftruncate_cbk (call_frame_t *frame, xlator_t *this, int32_t op_ret, int32_t op_errno, - struct stat *buf) + struct stat *prebuf, + struct stat *postbuf) { STACK_UNWIND (frame, op_ret, op_errno, - buf); + prebuf, + postbuf); return 0; } @@ -308,12 +313,14 @@ error_gen_readlink_cbk (call_frame_t *frame, xlator_t *this, int32_t op_ret, int32_t op_errno, - const char *path) + const char *path, + struct stat *sbuf) { STACK_UNWIND (frame, op_ret, op_errno, - path); + path, + sbuf); return 0; } @@ -347,7 +354,9 @@ error_gen_mknod_cbk (call_frame_t *frame, int32_t op_ret, int32_t op_errno, inode_t *inode, - struct stat *buf) + struct stat *buf, + struct stat *preparent, + struct stat *postparent) { STACK_UNWIND (frame, op_ret, @@ -386,7 +395,9 @@ error_gen_mkdir_cbk (call_frame_t *frame, int32_t op_ret, int32_t op_errno, inode_t *inode, - struct stat *buf) + struct stat *buf, + struct stat *preparent, + struct stat *postparent) { STACK_UNWIND (frame, op_ret, @@ -422,7 +433,9 @@ error_gen_unlink_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int32_t op_ret, - int32_t op_errno) + int32_t op_errno, + struct stat *preparent, + struct stat *postparent) { STACK_UNWIND (frame, op_ret, op_errno); return 0; @@ -453,7 +466,9 @@ error_gen_rmdir_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int32_t op_ret, - int32_t op_errno) + int32_t op_errno, + struct stat *preparent, + struct stat *postparent) { STACK_UNWIND (frame, op_ret, @@ -489,7 +504,9 @@ error_gen_symlink_cbk (call_frame_t *frame, int32_t op_ret, int32_t op_errno, inode_t *inode, - struct stat *buf) + struct stat *buf, + struct stat *preparent, + struct stat *postparent) { STACK_UNWIND (frame, op_ret, op_errno, inode, buf); return 0; @@ -523,7 +540,11 @@ error_gen_rename_cbk (call_frame_t *frame, xlator_t *this, int32_t op_ret, int32_t op_errno, - struct stat *buf) + struct stat *buf, + struct stat *preoldparent, + struct stat *postoldparent, + struct stat *prenewparent, + struct stat *postnewparent) { STACK_UNWIND (frame, op_ret, op_errno, buf); return 0; @@ -558,7 +579,9 @@ error_gen_link_cbk (call_frame_t *frame, int32_t op_ret, int32_t op_errno, inode_t *inode, - struct stat *buf) + struct stat *buf, + struct stat *preparent, + struct stat *postparent) { STACK_UNWIND (frame, op_ret, op_errno, inode, buf); return 0; @@ -594,7 +617,9 @@ error_gen_create_cbk (call_frame_t *frame, int32_t op_errno, fd_t *fd, inode_t *inode, - struct stat *buf) + struct stat *buf, + struct stat *preparent, + struct stat *postparent) { STACK_UNWIND (frame, op_ret, op_errno, fd, inode, buf); return 0; @@ -641,7 +666,7 @@ int32_t error_gen_open (call_frame_t *frame, xlator_t *this, loc_t *loc, - int32_t flags, fd_t *fd) + int32_t flags, fd_t *fd, int32_t wbflags) { int op_errno = 0; op_errno = error_gen(this); @@ -655,7 +680,7 @@ error_gen_open (call_frame_t *frame, error_gen_open_cbk, FIRST_CHILD(this), FIRST_CHILD(this)->fops->open, - loc, flags, fd); + loc, flags, fd, wbflags); return 0; } @@ -713,12 +738,14 @@ error_gen_writev_cbk (call_frame_t *frame, xlator_t *this, int32_t op_ret, int32_t op_errno, - struct stat *stbuf) + struct stat *prebuf, + struct stat *postbuf) { STACK_UNWIND (frame, op_ret, op_errno, - stbuf); + prebuf, + postbuf); return 0; } @@ -792,7 +819,9 @@ error_gen_fsync_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int32_t op_ret, - int32_t op_errno) + int32_t op_errno, + struct stat *prebuf, + struct stat *postbuf) { STACK_UNWIND (frame, op_ret, diff --git a/xlators/debug/io-stats/src/io-stats.c b/xlators/debug/io-stats/src/io-stats.c index 662762100fe..44e0371841b 100644 --- a/xlators/debug/io-stats/src/io-stats.c +++ b/xlators/debug/io-stats/src/io-stats.c @@ -79,7 +79,9 @@ io_stats_create_cbk (call_frame_t *frame, int32_t op_errno, fd_t *fd, inode_t *inode, - struct stat *buf) + struct stat *buf, + struct stat *preparent, + struct stat *postparent) { STACK_UNWIND (frame, op_ret, op_errno, fd, inode, buf); return 0; @@ -144,9 +146,10 @@ io_stats_writev_cbk (call_frame_t *frame, xlator_t *this, int32_t op_ret, int32_t op_errno, - struct stat *buf) + struct stat *prebuf, + struct stat *postbuf) { - STACK_UNWIND (frame, op_ret, op_errno, buf); + STACK_UNWIND (frame, op_ret, op_errno, prebuf, postbuf); return 0; } @@ -180,9 +183,11 @@ io_stats_fsync_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int32_t op_ret, - int32_t op_errno) + int32_t op_errno, + struct stat *prebuf, + struct stat *postbuf) { - STACK_UNWIND (frame, op_ret, op_errno); + STACK_UNWIND (frame, op_ret, op_errno, prebuf, postbuf); return 0; } @@ -204,7 +209,9 @@ io_stats_unlink_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int32_t op_ret, - int32_t op_errno) + int32_t op_errno, + struct stat *preparent, + struct stat *postparent) { STACK_UNWIND (frame, op_ret, op_errno); return 0; @@ -216,7 +223,11 @@ io_stats_rename_cbk (call_frame_t *frame, xlator_t *this, int32_t op_ret, int32_t op_errno, - struct stat *buf) + struct stat *buf, + struct stat *preoldparent, + struct stat *postoldparent, + struct stat *prenewparent, + struct stat *postnewparent) { STACK_UNWIND (frame, op_ret, op_errno, buf); return 0; @@ -228,9 +239,10 @@ io_stats_readlink_cbk (call_frame_t *frame, xlator_t *this, int32_t op_ret, int32_t op_errno, - const char *buf) + const char *buf, + struct stat *sbuf) { - STACK_UNWIND (frame, op_ret, op_errno, buf); + STACK_UNWIND (frame, op_ret, op_errno, buf, sbuf); return 0; } @@ -242,7 +254,8 @@ io_stats_lookup_cbk (call_frame_t *frame, int32_t op_errno, inode_t *inode, struct stat *buf, - dict_t *xattr) + dict_t *xattr, + struct stat *postmaster) { STACK_UNWIND (frame, op_ret, op_errno, inode, buf, xattr); return 0; @@ -255,7 +268,9 @@ io_stats_symlink_cbk (call_frame_t *frame, int32_t op_ret, int32_t op_errno, inode_t *inode, - struct stat *buf) + struct stat *buf, + struct stat *preparent, + struct stat *postparent) { STACK_UNWIND (frame, op_ret, op_errno, inode, buf); return 0; @@ -268,7 +283,9 @@ io_stats_mknod_cbk (call_frame_t *frame, int32_t op_ret, int32_t op_errno, inode_t *inode, - struct stat *buf) + struct stat *buf, + struct stat *preparent, + struct stat *postparent) { STACK_UNWIND (frame, op_ret, op_errno, inode, buf); return 0; @@ -282,7 +299,9 @@ io_stats_mkdir_cbk (call_frame_t *frame, int32_t op_ret, int32_t op_errno, inode_t *inode, - struct stat *buf) + struct stat *buf, + struct stat *preparent, + struct stat *postparent) { STACK_UNWIND (frame, op_ret, op_errno, inode, buf); return 0; @@ -295,7 +314,9 @@ io_stats_link_cbk (call_frame_t *frame, int32_t op_ret, int32_t op_errno, inode_t *inode, - struct stat *buf) + struct stat *buf, + struct stat *preparent, + struct stat *postparent) { STACK_UNWIND (frame, op_ret, op_errno, inode, buf); return 0; @@ -330,7 +351,9 @@ io_stats_rmdir_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int32_t op_ret, - int32_t op_errno) + int32_t op_errno, + struct stat *preparent, + struct stat *postparent) { STACK_UNWIND (frame, op_ret, op_errno); return 0; @@ -342,9 +365,10 @@ io_stats_truncate_cbk (call_frame_t *frame, xlator_t *this, int32_t op_ret, int32_t op_errno, - struct stat *buf) + struct stat *prebuf, + struct stat *postbuf) { - STACK_UNWIND (frame, op_ret, op_errno, buf); + STACK_UNWIND (frame, op_ret, op_errno, prebuf, postbuf); return 0; } @@ -466,9 +490,10 @@ io_stats_ftruncate_cbk (call_frame_t *frame, xlator_t *this, int32_t op_ret, int32_t op_errno, - struct stat *buf) + struct stat *prebuf, + struct stat *postbuf) { - STACK_UNWIND (frame, op_ret, op_errno, buf); + STACK_UNWIND (frame, op_ret, op_errno, prebuf, postbuf); return 0; } @@ -863,7 +888,7 @@ io_stats_open (call_frame_t *frame, xlator_t *this, loc_t *loc, int32_t flags, - fd_t *fd) + fd_t *fd, int32_t wbflags) { BUMP_HIT(OPEN); @@ -873,7 +898,7 @@ io_stats_open (call_frame_t *frame, FIRST_CHILD(this)->fops->open, loc, flags, - fd); + fd, wbflags); return 0; } diff --git a/xlators/debug/trace/src/trace.c b/xlators/debug/trace/src/trace.c index 2b66720a0cb..2504707627a 100644 --- a/xlators/debug/trace/src/trace.c +++ b/xlators/debug/trace/src/trace.c @@ -63,7 +63,9 @@ trace_create_cbk (call_frame_t *frame, int32_t op_errno, fd_t *fd, inode_t *inode, - struct stat *buf) + struct stat *buf, + struct stat *preparent, + struct stat *postparent) { char atime_buf[256], mtime_buf[256], ctime_buf[256]; ERR_EINVAL_NORETURN (!this); @@ -207,23 +209,24 @@ trace_writev_cbk (call_frame_t *frame, xlator_t *this, int32_t op_ret, int32_t op_errno, - struct stat *buf) + struct stat *prebuf, + struct stat *postbuf) { char atime_buf[256], mtime_buf[256], ctime_buf[256]; ERR_EINVAL_NORETURN (!this); if (trace_fop_names[GF_FOP_WRITE].enabled) { if (op_ret >= 0) { - strftime (atime_buf, 256, "[%b %d %H:%M:%S]", localtime (&buf->st_atime)); - strftime (mtime_buf, 256, "[%b %d %H:%M:%S]", localtime (&buf->st_mtime)); - strftime (ctime_buf, 256, "[%b %d %H:%M:%S]", localtime (&buf->st_ctime)); + strftime (atime_buf, 256, "[%b %d %H:%M:%S]", localtime (&postbuf->st_atime)); + strftime (mtime_buf, 256, "[%b %d %H:%M:%S]", localtime (&postbuf->st_mtime)); + strftime (ctime_buf, 256, "[%b %d %H:%M:%S]", localtime (&postbuf->st_ctime)); gf_log (this->name, GF_LOG_NORMAL, "%"PRId64": (op_ret=%d, *buf {st_ino=%"PRIu64", " "st_size=%"PRId64", st_blocks=%"PRId64", st_atime=%s, " "st_mtime=%s, st_ctime=%s})", - frame->root->unique, op_ret, buf->st_ino, buf->st_size, - buf->st_blocks, atime_buf, mtime_buf, ctime_buf); + frame->root->unique, op_ret, postbuf->st_ino, postbuf->st_size, + postbuf->st_blocks, atime_buf, mtime_buf, ctime_buf); } else { gf_log (this->name, GF_LOG_NORMAL, "%"PRId64": (op_ret=%d, op_errno=%d)", @@ -231,7 +234,7 @@ trace_writev_cbk (call_frame_t *frame, } } - STACK_UNWIND (frame, op_ret, op_errno, buf); + STACK_UNWIND (frame, op_ret, op_errno, prebuf, postbuf); return 0; } @@ -282,7 +285,9 @@ trace_fsync_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int32_t op_ret, - int32_t op_errno) + int32_t op_errno, + struct stat *prebuf, + struct stat *postbuf) { ERR_EINVAL_NORETURN (!this ); @@ -418,7 +423,9 @@ trace_unlink_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int32_t op_ret, - int32_t op_errno) + int32_t op_errno, + struct stat *preparent, + struct stat *postparent) { ERR_EINVAL_NORETURN (!this ); @@ -438,7 +445,11 @@ trace_rename_cbk (call_frame_t *frame, xlator_t *this, int32_t op_ret, int32_t op_errno, - struct stat *buf) + struct stat *buf, + struct stat *preoldparent, + struct stat *postoldparent, + struct stat *prenewparent, + struct stat *postnewparent) { ERR_EINVAL_NORETURN (!this ); @@ -459,7 +470,8 @@ trace_readlink_cbk (call_frame_t *frame, xlator_t *this, int32_t op_ret, int32_t op_errno, - const char *buf) + const char *buf, + struct stat *sbuf) { ERR_EINVAL_NORETURN (!this ); @@ -481,7 +493,8 @@ trace_lookup_cbk (call_frame_t *frame, int32_t op_errno, inode_t *inode, struct stat *buf, - dict_t *xattr) + dict_t *xattr, + struct stat *postparent) { ERR_EINVAL_NORETURN (!this ); @@ -514,7 +527,9 @@ trace_symlink_cbk (call_frame_t *frame, int32_t op_ret, int32_t op_errno, inode_t *inode, - struct stat *buf) + struct stat *buf, + struct stat *preparent, + struct stat *postparent) { char atime_buf[256], mtime_buf[256], ctime_buf[256]; ERR_EINVAL_NORETURN (!this ); @@ -551,7 +566,9 @@ trace_mknod_cbk (call_frame_t *frame, int32_t op_ret, int32_t op_errno, inode_t *inode, - struct stat *buf) + struct stat *buf, + struct stat *preparent, + struct stat *postparent) { char atime_buf[256], mtime_buf[256], ctime_buf[256]; ERR_EINVAL_NORETURN (!this ); @@ -591,7 +608,9 @@ trace_mkdir_cbk (call_frame_t *frame, int32_t op_ret, int32_t op_errno, inode_t *inode, - struct stat *buf) + struct stat *buf, + struct stat *preparent, + struct stat *postparent) { ERR_EINVAL_NORETURN (!this ); @@ -613,7 +632,9 @@ trace_link_cbk (call_frame_t *frame, int32_t op_ret, int32_t op_errno, inode_t *inode, - struct stat *buf) + struct stat *buf, + struct stat *preparent, + struct stat *postparent) { ERR_EINVAL_NORETURN (!this ); @@ -679,7 +700,9 @@ trace_rmdir_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int32_t op_ret, - int32_t op_errno) + int32_t op_errno, + struct stat *preparent, + struct stat *postparent) { ERR_EINVAL_NORETURN (!this ); @@ -699,7 +722,8 @@ trace_truncate_cbk (call_frame_t *frame, xlator_t *this, int32_t op_ret, int32_t op_errno, - struct stat *buf) + struct stat *prebuf, + struct stat *postbuf) { ERR_EINVAL_NORETURN (!this ); @@ -708,8 +732,8 @@ trace_truncate_cbk (call_frame_t *frame, gf_log (this->name, GF_LOG_NORMAL, "%"PRId64": (op_ret=%d, *buf {st_size=%"PRId64", st_blksize=%" GF_PRI_BLKSIZE", st_blocks=%"PRId64"})", - frame->root->unique, op_ret, buf->st_size, buf->st_blksize, - buf->st_blocks); + frame->root->unique, op_ret, postbuf->st_size, postbuf->st_blksize, + postbuf->st_blocks); } else { gf_log (this->name, GF_LOG_NORMAL, "%"PRId64": (op_ret=%d, op_errno=%d)", @@ -717,7 +741,7 @@ trace_truncate_cbk (call_frame_t *frame, } } - STACK_UNWIND (frame, op_ret, op_errno, buf); + STACK_UNWIND (frame, op_ret, op_errno, prebuf, postbuf); return 0; } @@ -855,7 +879,8 @@ trace_ftruncate_cbk (call_frame_t *frame, xlator_t *this, int32_t op_ret, int32_t op_errno, - struct stat *buf) + struct stat *prebuf, + struct stat *postbuf) { ERR_EINVAL_NORETURN (!this ); @@ -864,8 +889,8 @@ trace_ftruncate_cbk (call_frame_t *frame, gf_log (this->name, GF_LOG_NORMAL, "%"PRId64": (op_ret=%d, *buf {st_size=%"PRId64", " "st_blksize=%"GF_PRI_BLKSIZE", st_blocks=%"PRId64"})", - frame->root->unique, op_ret, buf->st_size, buf->st_blksize, - buf->st_blocks); + frame->root->unique, op_ret, postbuf->st_size, postbuf->st_blksize, + postbuf->st_blocks); } else { gf_log (this->name, GF_LOG_NORMAL, "%"PRId64": (op_ret=%d, op_errno=%d)", @@ -873,7 +898,7 @@ trace_ftruncate_cbk (call_frame_t *frame, } } - STACK_UNWIND (frame, op_ret, op_errno, buf); + STACK_UNWIND (frame, op_ret, op_errno, prebuf, postbuf); return 0; } @@ -1554,7 +1579,7 @@ trace_open (call_frame_t *frame, xlator_t *this, loc_t *loc, int32_t flags, - fd_t *fd) + fd_t *fd, int32_t wbflags) { ERR_EINVAL_NORETURN (!this || !loc); @@ -1570,7 +1595,7 @@ trace_open (call_frame_t *frame, FIRST_CHILD(this)->fops->open, loc, flags, - fd); + fd, wbflags); return 0; } diff --git a/xlators/encryption/rot-13/src/rot-13.c b/xlators/encryption/rot-13/src/rot-13.c index 738b8414f1e..5d691a2be33 100644 --- a/xlators/encryption/rot-13/src/rot-13.c +++ b/xlators/encryption/rot-13/src/rot-13.c @@ -100,9 +100,10 @@ rot13_writev_cbk (call_frame_t *frame, xlator_t *this, int32_t op_ret, int32_t op_errno, - struct stat *stbuf) + struct stat *prebuf, + struct stat *postbuf) { - STACK_UNWIND (frame, op_ret, op_errno, stbuf); + STACK_UNWIND (frame, op_ret, op_errno, prebuf, postbuf); return 0; } diff --git a/xlators/features/filter/src/filter.c b/xlators/features/filter/src/filter.c index 67395655771..ce31753a432 100644 --- a/xlators/features/filter/src/filter.c +++ b/xlators/features/filter/src/filter.c @@ -202,7 +202,8 @@ filter_lookup_cbk (call_frame_t *frame, int32_t op_errno, inode_t *inode, struct stat *buf, - dict_t *dict) + dict_t *dict, + struct stat *postparent) { int ret = 0; if (op_ret >= 0) { @@ -360,12 +361,13 @@ filter_truncate_cbk (call_frame_t *frame, xlator_t *this, int32_t op_ret, int32_t op_errno, - struct stat *buf) + struct stat *prebuf, + struct stat *postbuf) { if (op_ret >= 0) { - update_stat (buf, this->private); + update_stat (postbuf, this->private); } - STACK_UNWIND (frame, op_ret, op_errno, buf); + STACK_UNWIND (frame, op_ret, op_errno, prebuf, postbuf); return 0; } @@ -410,12 +412,13 @@ filter_ftruncate_cbk (call_frame_t *frame, xlator_t *this, int32_t op_ret, int32_t op_errno, - struct stat *buf) + struct stat *prebuf, + struct stat *postbuf) { if (op_ret >= 0) { - update_stat (buf, this->private); + update_stat (postbuf, this->private); } - STACK_UNWIND (frame, op_ret, op_errno, buf); + STACK_UNWIND (frame, op_ret, op_errno, prebuf, postbuf); return 0; } @@ -441,9 +444,10 @@ filter_readlink_cbk (call_frame_t *frame, xlator_t *this, int32_t op_ret, int32_t op_errno, - const char *path) + const char *path, + struct stat *sbuf) { - STACK_UNWIND (frame, op_ret, op_errno, path); + STACK_UNWIND (frame, op_ret, op_errno, path, sbuf); return 0; } @@ -483,7 +487,9 @@ filter_mknod_cbk (call_frame_t *frame, int32_t op_ret, int32_t op_errno, inode_t *inode, - struct stat *buf) + struct stat *buf, + struct stat *preparent, + struct stat *postparent) { int ret = 0; @@ -541,7 +547,9 @@ filter_mkdir_cbk (call_frame_t *frame, int32_t op_ret, int32_t op_errno, inode_t *inode, - struct stat *buf) + struct stat *buf, + struct stat *preparent, + struct stat *postparent) { int ret = 0; if (op_ret >= 0) { @@ -595,7 +603,9 @@ filter_unlink_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int32_t op_ret, - int32_t op_errno) + int32_t op_errno, + struct stat *preparent, + struct stat *postparent) { STACK_UNWIND (frame, op_ret, op_errno); return 0; @@ -644,7 +654,9 @@ filter_rmdir_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int32_t op_ret, - int32_t op_errno) + int32_t op_errno, + struct stat *preparent, + struct stat *postparent) { STACK_UNWIND (frame, op_ret, op_errno); return 0; @@ -695,7 +707,9 @@ filter_symlink_cbk (call_frame_t *frame, int32_t op_ret, int32_t op_errno, inode_t *inode, - struct stat *buf) + struct stat *buf, + struct stat *preparent, + struct stat *postparent) { int ret = 0; if (op_ret >= 0) { @@ -751,7 +765,11 @@ filter_rename_cbk (call_frame_t *frame, xlator_t *this, int32_t op_ret, int32_t op_errno, - struct stat *buf) + struct stat *buf, + struct stat *preoldparent, + struct stat *postoldparent, + struct stat *prenewparent, + struct stat *postnewparent) { if (op_ret >= 0) { update_stat (buf, this->private); @@ -809,7 +827,9 @@ filter_link_cbk (call_frame_t *frame, int32_t op_ret, int32_t op_errno, inode_t *inode, - struct stat *buf) + struct stat *buf, + struct stat *preparent, + struct stat *postparent) { int ret = 0; if (op_ret >= 0) { @@ -856,7 +876,9 @@ filter_create_cbk (call_frame_t *frame, int32_t op_errno, fd_t *fd, inode_t *inode, - struct stat *buf) + struct stat *buf, + struct stat *preparent, + struct stat *postparent) { int ret = 0; if (op_ret >= 0) { @@ -922,7 +944,8 @@ filter_open (call_frame_t *frame, xlator_t *this, loc_t *loc, int32_t flags, - fd_t *fd) + fd_t *fd, + int32_t wbflags) { int32_t ret = 0; ret = update_frame (frame, loc->inode, this->private); @@ -960,7 +983,7 @@ filter_open (call_frame_t *frame, filter_open_cbk, FIRST_CHILD(this), FIRST_CHILD(this)->fops->open, - loc, flags, fd); + loc, flags, fd, wbflags); return 0; } @@ -1012,15 +1035,17 @@ filter_writev_cbk (call_frame_t *frame, xlator_t *this, int32_t op_ret, int32_t op_errno, - struct stat *stbuf) + struct stat *prebuf, + struct stat *postbuf) { if (op_ret >= 0) { - update_stat (stbuf, this->private); + update_stat (postbuf, this->private); } STACK_UNWIND (frame, op_ret, op_errno, - stbuf); + prebuf, + postbuf); return 0; } diff --git a/xlators/features/locks/src/posix.c b/xlators/features/locks/src/posix.c index 605902641d4..379c2d9158c 100644 --- a/xlators/features/locks/src/posix.c +++ b/xlators/features/locks/src/posix.c @@ -58,7 +58,8 @@ struct _truncate_ops { int pl_truncate_cbk (call_frame_t *frame, void *cookie, xlator_t *this, - int32_t op_ret, int32_t op_errno, struct stat *buf) + int32_t op_ret, int32_t op_errno, struct stat *prebuf, + struct stat *postbuf) { struct _truncate_ops *local = NULL; @@ -67,7 +68,7 @@ pl_truncate_cbk (call_frame_t *frame, void *cookie, xlator_t *this, if (local->op == TRUNCATE) loc_wipe (&local->loc); - STACK_UNWIND (frame, op_ret, op_errno, buf); + STACK_UNWIND (frame, op_ret, op_errno, prebuf, postbuf); return 0; } @@ -307,13 +308,13 @@ pl_open_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int -pl_open (call_frame_t *frame, xlator_t *this, - loc_t *loc, int32_t flags, fd_t *fd) +pl_open (call_frame_t *frame, xlator_t *this, loc_t *loc, int32_t flags, + fd_t *fd, int32_t wbflags) { /* why isn't O_TRUNC being handled ? */ STACK_WIND (frame, pl_open_cbk, FIRST_CHILD(this), FIRST_CHILD(this)->fops->open, - loc, flags & ~O_TRUNC, fd); + loc, flags & ~O_TRUNC, fd, wbflags); return 0; } @@ -322,7 +323,8 @@ pl_open (call_frame_t *frame, xlator_t *this, int pl_create_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int32_t op_ret, int32_t op_errno, - fd_t *fd, inode_t *inode, struct stat *buf) + fd_t *fd, inode_t *inode, struct stat *buf, + struct stat *preparent, struct stat *postparent) { STACK_UNWIND (frame, op_ret, op_errno, fd, inode, buf); @@ -354,9 +356,10 @@ pl_readv_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int pl_writev_cbk (call_frame_t *frame, void *cookie, xlator_t *this, - int32_t op_ret, int32_t op_errno, struct stat *stbuf) + int32_t op_ret, int32_t op_errno, struct stat *prebuf, + struct stat *postbuf) { - STACK_UNWIND (frame, op_ret, op_errno, stbuf); + STACK_UNWIND (frame, op_ret, op_errno, prebuf, postbuf); return 0; } diff --git a/xlators/features/path-convertor/src/path.c b/xlators/features/path-convertor/src/path.c index b53286104aa..9657def90c4 100644 --- a/xlators/features/path-convertor/src/path.c +++ b/xlators/features/path-convertor/src/path.c @@ -134,7 +134,9 @@ path_create_cbk (call_frame_t *frame, int32_t op_errno, fd_t *fd, inode_t *inode, - struct stat *buf) + struct stat *buf, + struct stat *preparent, + struct stat *postparent) { STACK_UNWIND (frame, op_ret, op_errno, fd, inode, buf); return 0; @@ -184,9 +186,10 @@ path_readlink_cbk (call_frame_t *frame, xlator_t *this, int32_t op_ret, int32_t op_errno, - const char *buf) + const char *buf, + struct stat *sbuf) { - STACK_UNWIND (frame, op_ret, op_errno, buf); + STACK_UNWIND (frame, op_ret, op_errno, buf, sbuf); return 0; } @@ -198,7 +201,8 @@ path_lookup_cbk (call_frame_t *frame, int32_t op_errno, inode_t *inode, struct stat *buf, - dict_t *xattr) + dict_t *xattr, + struct stat *postparent) { STACK_UNWIND (frame, op_ret, op_errno, inode, buf, xattr); return 0; @@ -212,7 +216,9 @@ path_symlink_cbk (call_frame_t *frame, int32_t op_ret, int32_t op_errno, inode_t *inode, - struct stat *buf) + struct stat *buf, + struct stat *preparent, + struct stat *postparent) { STACK_UNWIND (frame, op_ret, op_errno, inode, buf); return 0; @@ -225,7 +231,9 @@ path_mknod_cbk (call_frame_t *frame, int32_t op_ret, int32_t op_errno, inode_t *inode, - struct stat *buf) + struct stat *buf, + struct stat *preparent, + struct stat *postparent) { STACK_UNWIND (frame, op_ret, op_errno, inode, buf); return 0; @@ -239,7 +247,9 @@ path_mkdir_cbk (call_frame_t *frame, int32_t op_ret, int32_t op_errno, inode_t *inode, - struct stat *buf) + struct stat *buf, + struct stat *preparent, + struct stat *postparent) { STACK_UNWIND (frame, op_ret, op_errno, inode, buf); return 0; @@ -252,7 +262,9 @@ path_link_cbk (call_frame_t *frame, int32_t op_ret, int32_t op_errno, inode_t *inode, - struct stat *buf) + struct stat *buf, + struct stat *preparent, + struct stat *postparent) { STACK_UNWIND (frame, op_ret, op_errno, inode, buf); return 0; @@ -271,7 +283,25 @@ path_opendir_cbk (call_frame_t *frame, } -int32_t +int32_t +path_rename_buf_cbk (call_frame_t *frame, + void *cookie, + xlator_t *this, + int32_t op_ret, + int32_t op_errno, + struct stat *buf, + struct stat *preoldparent, + struct stat *postoldparent, + struct stat *prenewparent, + struct stat *postnewparent) +{ + STACK_UNWIND (frame, op_ret, op_errno, buf); + return 0; +} + + + +int32_t path_common_buf_cbk (call_frame_t *frame, void *cookie, xlator_t *this, @@ -296,6 +326,25 @@ path_common_dict_cbk (call_frame_t *frame, } int32_t +path_common_remove_cbk (call_frame_t *frame, void *cookie, xlator_t *this, + int32_t op_ret, int32_t op_errno,struct stat *preparent, + struct stat *postparent) +{ + STACK_UNWIND (frame, op_ret, op_errno); + return 0; +} + +int32_t +path_truncate_cbk (call_frame_t *frame, void *cookie, xlator_t *this, + int32_t op_ret, int32_t op_errno,struct stat *prebuf, + struct stat *postbuf) +{ + STACK_UNWIND (frame, op_ret, op_errno, prebuf, postbuf); + return 0; +} + + +int32_t path_common_cbk (call_frame_t *frame, void *cookie, xlator_t *this, @@ -465,7 +514,7 @@ path_unlink (call_frame_t *frame, loc->path = tmp_path; STACK_WIND (frame, - path_common_cbk, + path_common_remove_cbk, FIRST_CHILD(this), FIRST_CHILD(this)->fops->unlink, loc); @@ -492,7 +541,7 @@ path_rmdir (call_frame_t *frame, loc->path = tmp_path; STACK_WIND (frame, - path_common_cbk, + path_common_remove_cbk, FIRST_CHILD(this), FIRST_CHILD(this)->fops->rmdir, loc); @@ -558,7 +607,7 @@ path_rename (call_frame_t *frame, newloc->path = tmp_newloc_path; STACK_WIND (frame, - path_common_buf_cbk, + path_rename_buf_cbk, FIRST_CHILD(this), FIRST_CHILD(this)->fops->rename, oldloc, @@ -677,7 +726,7 @@ path_truncate (call_frame_t *frame, loc->path = tmp_path; STACK_WIND (frame, - path_common_buf_cbk, + path_truncate_cbk, FIRST_CHILD(this), FIRST_CHILD(this)->fops->truncate, loc, @@ -696,7 +745,8 @@ path_open (call_frame_t *frame, xlator_t *this, loc_t *loc, int32_t flags, - fd_t *fd) + fd_t *fd, + int32_t wbflags) { char *loc_path = (char *)loc->path; char *tmp_path = NULL; @@ -713,7 +763,8 @@ path_open (call_frame_t *frame, FIRST_CHILD(this)->fops->open, loc, flags, - fd); + fd, + wbflags); loc->path = loc_path; if (tmp_path != loc_path) diff --git a/xlators/features/quota/src/quota.c b/xlators/features/quota/src/quota.c index 94a7ec83b25..e6c5b5dbfb3 100644 --- a/xlators/features/quota/src/quota.c +++ b/xlators/features/quota/src/quota.c @@ -154,7 +154,8 @@ gf_quota_check_free_disk (xlator_t *this) int quota_truncate_cbk (call_frame_t *frame, void *cookie, xlator_t *this, - int32_t op_ret, int32_t op_errno, struct stat *buf) + int32_t op_ret, int32_t op_errno, struct stat *prebuf, + struct stat *postbuf) { struct quota_priv *priv = this->private; struct quota_local *local = NULL; @@ -163,11 +164,11 @@ quota_truncate_cbk (call_frame_t *frame, void *cookie, xlator_t *this, if ((op_ret >= 0) && priv->disk_usage_limit) { gf_quota_usage_subtract (this, (local->stbuf.st_blocks - - buf->st_blocks) * 512); + postbuf->st_blocks) * 512); loc_wipe (&local->loc); } - STACK_UNWIND (frame, op_ret, op_errno, buf); + STACK_UNWIND (frame, op_ret, op_errno, prebuf, postbuf); return 0; } @@ -225,7 +226,8 @@ quota_truncate (call_frame_t *frame, xlator_t *this, int quota_ftruncate_cbk (call_frame_t *frame, void *cookie, xlator_t *this, - int32_t op_ret, int32_t op_errno, struct stat *buf) + int32_t op_ret, int32_t op_errno, struct stat *prebuf, + struct stat *postbuf) { struct quota_priv *priv = NULL; struct quota_local *local = NULL; @@ -235,11 +237,11 @@ quota_ftruncate_cbk (call_frame_t *frame, void *cookie, xlator_t *this, if ((op_ret >= 0) && priv->disk_usage_limit) { gf_quota_usage_subtract (this, (local->stbuf.st_blocks - - buf->st_blocks) * 512); + postbuf->st_blocks) * 512); fd_unref (local->fd); } - STACK_UNWIND (frame, op_ret, op_errno, buf); + STACK_UNWIND (frame, op_ret, op_errno, prebuf, postbuf); return 0; } @@ -299,7 +301,8 @@ quota_ftruncate (call_frame_t *frame, xlator_t *this, int quota_mknod_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int32_t op_ret, int32_t op_errno, - inode_t *inode, struct stat *buf) + inode_t *inode, struct stat *buf, struct stat *preparent, + struct stat *postparent) { struct quota_priv *priv = NULL; @@ -349,7 +352,8 @@ quota_mknod (call_frame_t *frame, xlator_t *this, int quota_mkdir_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int32_t op_ret, int32_t op_errno, inode_t *inode, - struct stat *buf) + struct stat *buf, struct stat *preparent, + struct stat *postparent) { struct quota_priv *priv = NULL; @@ -399,7 +403,8 @@ quota_mkdir (call_frame_t *frame, xlator_t *this, loc_t *loc, mode_t mode) int quota_unlink_cbk (call_frame_t *frame, void *cookie, xlator_t *this, - int32_t op_ret, int32_t op_errno) + int32_t op_ret, int32_t op_errno, struct stat *preparent, + struct stat *postparent) { struct quota_local *local = NULL; @@ -473,7 +478,8 @@ quota_unlink (call_frame_t *frame, xlator_t *this, loc_t *loc) int quota_rmdir_cbk (call_frame_t *frame, void *cookie, xlator_t *this, - int32_t op_ret, int32_t op_errno) + int32_t op_ret, int32_t op_errno, struct stat *preparent, + struct stat *postparent) { struct quota_local *local = NULL; @@ -543,7 +549,8 @@ quota_rmdir (call_frame_t *frame, xlator_t *this, loc_t *loc) int quota_symlink_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int32_t op_ret, int32_t op_errno, inode_t *inode, - struct stat *buf) + struct stat *buf, struct stat *preparent, + struct stat *postparent) { struct quota_priv *priv = NULL; @@ -593,7 +600,8 @@ quota_symlink (call_frame_t *frame, xlator_t *this, int quota_create_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int32_t op_ret, int32_t op_errno, - fd_t *fd, inode_t *inode, struct stat *buf) + fd_t *fd, inode_t *inode, struct stat *buf, + struct stat *preparent, struct stat *postparent) { struct quota_priv *priv = this->private; int ret = 0; @@ -656,20 +664,21 @@ quota_open_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int -quota_open (call_frame_t *frame, xlator_t *this, - loc_t *loc, int32_t flags, fd_t *fd) +quota_open (call_frame_t *frame, xlator_t *this, loc_t *loc, int32_t flags, + fd_t *fd, int32_t wbflags) { STACK_WIND (frame, quota_open_cbk, FIRST_CHILD(this), FIRST_CHILD(this)->fops->open, - loc, flags, fd); + loc, flags, fd, wbflags); return 0; } int quota_writev_cbk (call_frame_t *frame, void *cookie, xlator_t *this, - int32_t op_ret, int32_t op_errno, struct stat *stbuf) + int32_t op_ret, int32_t op_errno, struct stat *prebuf, + struct stat *postbuf) { struct quota_priv *priv = NULL; struct quota_local *local = NULL; @@ -680,14 +689,14 @@ quota_writev_cbk (call_frame_t *frame, void *cookie, xlator_t *this, if (priv->disk_usage_limit) { if (op_ret >= 0) { - gf_quota_usage_add (this, (stbuf->st_blocks - + gf_quota_usage_add (this, (postbuf->st_blocks - local->stbuf.st_blocks) * 512); } fd_unref (local->fd); iobref_unref (local->iobref); } - STACK_UNWIND (frame, op_ret, op_errno, stbuf); + STACK_UNWIND (frame, op_ret, op_errno, prebuf, postbuf); return 0; } diff --git a/xlators/features/trash/src/trash.c b/xlators/features/trash/src/trash.c index fa5d752eab7..cc5a691521b 100644 --- a/xlators/features/trash/src/trash.c +++ b/xlators/features/trash/src/trash.c @@ -56,14 +56,22 @@ trash_unlink_rename_cbk (call_frame_t *frame, xlator_t *this, int32_t op_ret, int32_t op_errno, - struct stat *buf); + struct stat *buf, + struct stat *preoldparent, + struct stat *postoldparent, + struct stat *prenewparent, + struct stat *postnewparent); int32_t trash_rename_rename_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int32_t op_ret, int32_t op_errno, - struct stat *buf); + struct stat *buf, + struct stat *preoldparent, + struct stat *postoldparent, + struct stat *prenewparent, + struct stat *postnewparent); /** * trash_common_unwind_cbk - @@ -73,7 +81,9 @@ trash_common_unwind_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int32_t op_ret, - int32_t op_errno) + int32_t op_errno, + struct stat *preparent, + struct stat *postparent) { trash_local_t *local = frame->local; @@ -91,6 +101,39 @@ trash_common_unwind_cbk (call_frame_t *frame, return 0; } + +/** + * trash_rename_unwind_buf_cbk - + */ +int32_t +trash_rename_unwind_buf_cbk (call_frame_t *frame, + void *cookie, + xlator_t *this, + int32_t op_ret, + int32_t op_errno, + struct stat *buf, + struct stat *preoldparent, + struct stat *postoldparent, + struct stat *prenewparent, + struct stat *postnewparent) +{ + trash_local_t *local = frame->local; + + if (!local) + goto out; + + if (local->loc1.path) + loc_wipe (&local->loc1); + + if (local->loc2.path) + loc_wipe (&local->loc2); + + out: + STACK_UNWIND (frame, op_ret, op_errno, buf); + return 0; +} + + /** * trash_common_unwind_buf_cbk - */ @@ -125,7 +168,9 @@ trash_mkdir_cbk (call_frame_t *frame, int32_t op_ret, int32_t op_errno, inode_t *inode, - struct stat *stbuf) + struct stat *stbuf, + struct stat *preparent, + struct stat *postparent) { trash_local_t *local = frame->local; char *tmp_str = strdup (local->newpath); @@ -189,7 +234,11 @@ trash_unlink_rename_cbk (call_frame_t *frame, xlator_t *this, int32_t op_ret, int32_t op_errno, - struct stat *buf) + struct stat *buf, + struct stat *preoldparent, + struct stat *postoldparent, + struct stat *prenewparent, + struct stat *postnewparent) { trash_local_t *local = frame->local; if (op_ret == -1 && op_errno == ENOENT) { @@ -302,7 +351,9 @@ trash_rename_mkdir_cbk (call_frame_t *frame, int32_t op_ret, int32_t op_errno, inode_t *inode, - struct stat *stbuf) + struct stat *stbuf, + struct stat *preparent, + struct stat *postparent) { trash_local_t *local = frame->local; char *tmp_str = strdup (local->newpath); @@ -367,7 +418,11 @@ trash_rename_rename_cbk (call_frame_t *frame, xlator_t *this, int32_t op_ret, int32_t op_errno, - struct stat *buf) + struct stat *buf, + struct stat *preoldparent, + struct stat *postoldparent, + struct stat *prenewparent, + struct stat *postnewparent) { trash_local_t *local = frame->local; if (op_ret == -1 && op_errno == ENOENT) { @@ -407,7 +462,7 @@ trash_rename_rename_cbk (call_frame_t *frame, .path = local->loc2.path, }; STACK_WIND (frame, - trash_common_unwind_buf_cbk, + trash_rename_unwind_buf_cbk, this->children->xlator, this->children->xlator->fops->rename, &local->loc1, @@ -427,13 +482,14 @@ trash_rename_lookup_cbk (call_frame_t *frame, int32_t op_errno, inode_t *inode, struct stat *buf, - dict_t *xattr) + dict_t *xattr, + struct stat *postparent) { trash_local_t *local = frame->local; if (op_ret == -1) { STACK_WIND (frame, - trash_common_unwind_buf_cbk, + trash_rename_unwind_buf_cbk, this->children->xlator, this->children->xlator->fops->rename, &local->loc1, @@ -481,7 +537,7 @@ trash_rename (call_frame_t *frame, /* Trying to rename from the trash can dir, do the actual rename */ STACK_WIND (frame, - trash_common_unwind_buf_cbk, + trash_rename_unwind_buf_cbk, this->children->xlator, this->children->xlator->fops->rename, oldloc, diff --git a/xlators/mount/fuse/src/fuse-bridge.c b/xlators/mount/fuse/src/fuse-bridge.c index b002d264c12..8b97800a92c 100644 --- a/xlators/mount/fuse/src/fuse-bridge.c +++ b/xlators/mount/fuse/src/fuse-bridge.c @@ -494,7 +494,117 @@ stat2attr (struct stat *st, struct fuse_attr *fa) static int fuse_lookup_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int32_t op_ret, int32_t op_errno, - inode_t *inode, struct stat *stat, dict_t *dict); + inode_t *inode, struct stat *stat, dict_t *dict, + struct stat *postparent); + + +static int +fuse_newentry_cbk (call_frame_t *frame, void *cookie, xlator_t *this, + int32_t op_ret, int32_t op_errno, + inode_t *inode, struct stat *buf, struct stat *preparent, + struct stat *postparent) +{ + fuse_state_t *state = NULL; + fuse_in_header_t *finh = NULL; + struct fuse_entry_out feo = {0, }; + struct fuse_attr_out *fao = NULL; + fuse_private_t *priv = NULL; + + priv = this->private; + state = frame->root->state; + finh = state->finh; + + if (!op_ret && state->loc.ino == 1) { + buf->st_ino = 1; + } + + if (state->is_revalidate == 1 + && need_fresh_lookup (op_ret, op_errno, &state->loc, buf)) { + inode_unref (state->loc.inode); + state->loc.inode = inode_new (state->itable); + state->is_revalidate = 2; + + STACK_WIND (frame, fuse_lookup_cbk, + FIRST_CHILD (this), + FIRST_CHILD (this)->fops->lookup, + &state->loc, state->dict); + + return 0; + } + + if (op_ret == 0) { + gf_log ("glusterfs-fuse", GF_LOG_TRACE, + "%"PRIu64": %s() %s => %"PRId64" (%"PRId64")", + frame->root->unique, gf_fop_list[frame->root->op], + state->loc.path, buf->st_ino, state->loc.ino); + + inode_link (inode, state->loc.parent, state->loc.name, buf); + + inode_lookup (inode); + + buf->st_blksize = this->ctx->page_size; + stat2attr (buf, &feo.attr); + + if (!inode->ino || !buf->st_ino) { + gf_log ("glusterfs-fuse", GF_LOG_WARNING, + "%"PRIu64": %s() %s returning inode 0", + frame->root->unique, + gf_fop_list[frame->root->op], state->loc.path); + } + + if (state->loc.parent) { + /* TODO: make these timeouts configurable (via meta?) */ + feo.nodeid = inode->ino; + +#ifdef GF_DARWIN_HOST_OS + feo.generation = 0; +#else + feo.generation = buf->st_ctime; +#endif + + feo.entry_valid = + calc_timeout_sec (priv->entry_timeout); + feo.entry_valid_nsec = + calc_timeout_nsec (priv->entry_timeout); + feo.attr_valid = + calc_timeout_sec (priv->attribute_timeout); + feo.attr_valid_nsec = + calc_timeout_nsec (priv->attribute_timeout); + + priv->proto_minor >= 9 ? + send_fuse_obj (this, finh, &feo) : + send_fuse_data (this, finh, &feo, + FUSE_COMPAT_ENTRY_OUT_SIZE); + } else { + /* Refurbish the entry_out as attr_out. Too hacky?... */ + fao = (struct fuse_attr_out *) + ((char *)&feo.attr - + offsetof (struct fuse_attr_out, attr)); + + fao->attr_valid = + calc_timeout_sec (priv->attribute_timeout); + fao->attr_valid_nsec = + calc_timeout_nsec (priv->attribute_timeout); + + priv->proto_minor >= 9 ? + send_fuse_obj (this, finh, fao) : + send_fuse_data (this, finh, fao, + FUSE_COMPAT_ATTR_OUT_SIZE); + } + } else { + gf_log ("glusterfs-fuse", + (op_errno == ENOENT ? GF_LOG_TRACE : GF_LOG_WARNING), + "%"PRIu64": %s() %s => -1 (%s)", frame->root->unique, + gf_fop_list[frame->root->op], state->loc.path, + strerror (op_errno)); + send_fuse_err (this, state->finh, op_errno); + } + + free_state (state); + STACK_DESTROY (frame->root); + return 0; +} + static int fuse_entry_cbk (call_frame_t *frame, void *cookie, xlator_t *this, @@ -606,7 +716,8 @@ fuse_entry_cbk (call_frame_t *frame, void *cookie, xlator_t *this, static int fuse_lookup_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int32_t op_ret, int32_t op_errno, - inode_t *inode, struct stat *stat, dict_t *dict) + inode_t *inode, struct stat *stat, dict_t *dict, + struct stat *postparent) { fuse_entry_cbk (frame, cookie, this, op_ret, op_errno, inode, stat); return 0; @@ -682,6 +793,62 @@ fuse_forget (xlator_t *this, fuse_in_header_t *finh, void *msg) FREE (finh); } + + +static int +fuse_truncate_cbk (call_frame_t *frame, void *cookie, xlator_t *this, + int32_t op_ret, int32_t op_errno, struct stat *buf, + struct stat *postbuf) +{ + fuse_state_t *state; + fuse_in_header_t *finh; + fuse_private_t *priv = NULL; + struct fuse_attr_out fao; + + priv = this->private; + state = frame->root->state; + finh = state->finh; + + if (op_ret == 0) { + gf_log ("glusterfs-fuse", GF_LOG_TRACE, + "%"PRIu64": %s() %s => %"PRId64, frame->root->unique, + gf_fop_list[frame->root->op], + state->loc.path ? state->loc.path : "ERR", + buf->st_ino); + + /* TODO: make these timeouts configurable via meta */ + /* TODO: what if the inode number has changed by now */ + buf->st_blksize = this->ctx->page_size; + stat2attr (buf, &fao.attr); + + fao.attr_valid = calc_timeout_sec (priv->attribute_timeout); + fao.attr_valid_nsec = + calc_timeout_nsec (priv->attribute_timeout); + + priv->proto_minor >= 9 ? + send_fuse_obj (this, finh, &fao) : + send_fuse_data (this, finh, &fao, + FUSE_COMPAT_ATTR_OUT_SIZE); + } else { + gf_log ("glusterfs-fuse", GF_LOG_WARNING, + "%"PRIu64": %s() %s => -1 (%s)", frame->root->unique, + gf_fop_list[frame->root->op], + state->loc.path ? state->loc.path : "ERR", + strerror (op_errno)); + + if (can_fuse_return (state, 0)) + send_fuse_err (this, finh, op_errno); + } + + if (state->callcount == 0) { + free_state (state); + STACK_DESTROY (frame->root); + } + + return 0; +} + + static int @@ -926,10 +1093,10 @@ static void fuse_do_truncate (fuse_state_t *state, struct fuse_setattr_in *fsi) { if (state->fd) { - FUSE_FOP (state, fuse_attr_cbk, GF_FOP_FTRUNCATE, + FUSE_FOP (state, fuse_truncate_cbk, GF_FOP_FTRUNCATE, ftruncate, state->fd, fsi->size); } else { - FUSE_FOP (state, fuse_attr_cbk, GF_FOP_TRUNCATE, + FUSE_FOP (state, fuse_truncate_cbk, GF_FOP_TRUNCATE, truncate, &state->loc, fsi->size); } @@ -1032,6 +1199,58 @@ fuse_setattr (xlator_t *this, fuse_in_header_t *finh, void *msg) static int gf_fuse_xattr_enotsup_log; +static int +fuse_fsync_cbk (call_frame_t *frame, void *cookie, xlator_t *this, + int32_t op_ret, int32_t op_errno, struct stat *prebuf, + struct stat *postbuf) +{ + fuse_state_t *state = frame->root->state; + fuse_in_header_t *finh = state->finh; + + if (op_ret == 0) { + gf_log ("glusterfs-fuse", GF_LOG_TRACE, + "%"PRIu64": %s() %s => 0", frame->root->unique, + gf_fop_list[frame->root->op], + state->loc.path ? state->loc.path : "ERR"); + + send_fuse_err (this, finh, 0); + } else { + if (frame->root->op == GF_FOP_SETXATTR) { + op_ret = gf_compat_setxattr (state->dict); + if (op_ret == 0) + op_errno = 0; + if (op_errno == ENOTSUP) { + gf_fuse_xattr_enotsup_log++; + if (!(gf_fuse_xattr_enotsup_log % GF_UNIVERSAL_ANSWER)) + gf_log ("glusterfs-fuse", + GF_LOG_CRITICAL, + "extended attribute not " + "supported by the backend " + "storage"); + } + } else { + if ((frame->root->op == GF_FOP_REMOVEXATTR) + && (op_errno == ENOATTR)) { + goto nolog; + } + gf_log ("glusterfs-fuse", GF_LOG_WARNING, + "%"PRIu64": %s() %s => -1 (%s)", + frame->root->unique, + gf_fop_list[frame->root->op], + state->loc.path ? state->loc.path : "ERR", + strerror (op_errno)); + } + nolog: + + send_fuse_err (this, finh, op_errno); + } + + free_state (state); + STACK_DESTROY (frame->root); + + return 0; +} + static int fuse_err_cbk (call_frame_t *frame, void *cookie, xlator_t *this, @@ -1087,7 +1306,8 @@ fuse_err_cbk (call_frame_t *frame, void *cookie, xlator_t *this, static int fuse_unlink_cbk (call_frame_t *frame, void *cookie, xlator_t *this, - int32_t op_ret, int32_t op_errno) + int32_t op_ret, int32_t op_errno, struct stat *preparent, + struct stat *postparent) { fuse_state_t *state = NULL; fuse_in_header_t *finh = NULL; @@ -1157,7 +1377,8 @@ fuse_access (xlator_t *this, fuse_in_header_t *finh, void *msg) static int fuse_readlink_cbk (call_frame_t *frame, void *cookie, xlator_t *this, - int32_t op_ret, int32_t op_errno, const char *linkname) + int32_t op_ret, int32_t op_errno, const char *linkname, + struct stat *buf) { fuse_state_t *state = NULL; fuse_in_header_t *finh = NULL; @@ -1249,7 +1470,7 @@ fuse_mknod (xlator_t *this, fuse_in_header_t *finh, void *msg) "%"PRIu64": MKNOD %s", finh->unique, state->loc.path); - FUSE_FOP (state, fuse_entry_cbk, GF_FOP_MKNOD, + FUSE_FOP (state, fuse_newentry_cbk, GF_FOP_MKNOD, mknod, &state->loc, fmi->mode, fmi->rdev); return; @@ -1282,7 +1503,7 @@ fuse_mkdir (xlator_t *this, fuse_in_header_t *finh, void *msg) "%"PRIu64": MKDIR %s", finh->unique, state->loc.path); - FUSE_FOP (state, fuse_entry_cbk, GF_FOP_MKDIR, + FUSE_FOP (state, fuse_newentry_cbk, GF_FOP_MKDIR, mkdir, &state->loc, fmi->mode); return; @@ -1379,7 +1600,7 @@ fuse_symlink (xlator_t *this, fuse_in_header_t *finh, void *msg) "%"PRIu64": SYMLINK %s -> %s", finh->unique, state->loc.path, linkname); - FUSE_FOP (state, fuse_entry_cbk, GF_FOP_SYMLINK, + FUSE_FOP (state, fuse_newentry_cbk, GF_FOP_SYMLINK, symlink, linkname, &state->loc); return; @@ -1388,7 +1609,9 @@ fuse_symlink (xlator_t *this, fuse_in_header_t *finh, void *msg) int fuse_rename_cbk (call_frame_t *frame, void *cookie, xlator_t *this, - int32_t op_ret, int32_t op_errno, struct stat *buf) + int32_t op_ret, int32_t op_errno, struct stat *buf, + struct stat *preoldparent, struct stat *postoldparent, + struct stat *prenewparent, struct stat *postnewparent) { fuse_state_t *state = NULL; fuse_in_header_t *finh = NULL; @@ -1513,7 +1736,7 @@ fuse_link (xlator_t *this, fuse_in_header_t *finh, void *msg) finh->unique, state->loc2.path, state->loc2.ino, state->loc.path, state->loc.ino); - FUSE_FOP (state, fuse_entry_cbk, GF_FOP_LINK, + FUSE_FOP (state, fuse_newentry_cbk, GF_FOP_LINK, link, &state->loc2, &state->loc); return; @@ -1523,7 +1746,8 @@ fuse_link (xlator_t *this, fuse_in_header_t *finh, void *msg) static int fuse_create_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int32_t op_ret, int32_t op_errno, - fd_t *fd, inode_t *inode, struct stat *buf) + fd_t *fd, inode_t *inode, struct stat *buf, + struct stat *preparent, struct stat *postparent) { fuse_state_t *state = NULL; fuse_in_header_t *finh = NULL; @@ -1683,7 +1907,7 @@ fuse_open (xlator_t *this, fuse_in_header_t *finh, void *msg) state->loc.path); FUSE_FOP (state, fuse_fd_cbk, GF_FOP_OPEN, - open, &state->loc, foi->flags, fd); + open, &state->loc, foi->flags, fd, 0); return; } @@ -1761,7 +1985,7 @@ fuse_readv (xlator_t *this, fuse_in_header_t *finh, void *msg) static int fuse_writev_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int32_t op_ret, int32_t op_errno, - struct stat *stbuf) + struct stat *stbuf, struct stat *postbuf) { fuse_state_t *state = NULL; fuse_in_header_t *finh = NULL; @@ -1949,7 +2173,7 @@ fuse_fsync (xlator_t *this, fuse_in_header_t *finh, void *msg) "%"PRIu64": FSYNC %p", finh->unique, fd); /* fsync_flags: 1 means "datasync" (no defines for this) */ - FUSE_FOP (state, fuse_err_cbk, GF_FOP_FSYNC, + FUSE_FOP (state, fuse_fsync_cbk, GF_FOP_FSYNC, fsync, fd, fsi->fsync_flags & 1); return; @@ -2810,7 +3034,8 @@ static fuse_handler_t *fuse_ops[FUSE_712_OP_HIGH]; int fuse_root_lookup_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int32_t op_ret, int32_t op_errno, - inode_t *inode, struct stat *buf, dict_t *xattr) + inode_t *inode, struct stat *buf, dict_t *xattr, + struct stat *postparent) { fuse_private_t *priv = NULL; diff --git a/xlators/performance/io-cache/src/io-cache.c b/xlators/performance/io-cache/src/io-cache.c index db1e204fd4f..53c7b1f10bd 100644 --- a/xlators/performance/io-cache/src/io-cache.c +++ b/xlators/performance/io-cache/src/io-cache.c @@ -163,7 +163,7 @@ ioc_setattr (call_frame_t *frame, xlator_t *this, loc_t *loc, int32_t ioc_lookup_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int32_t op_ret, int32_t op_errno, inode_t *inode, - struct stat *stbuf, dict_t *dict) + struct stat *stbuf, dict_t *dict, struct stat *postparent) { ioc_inode_t *ioc_inode = NULL; ioc_local_t *local = frame->local; @@ -745,7 +745,8 @@ ioc_open_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int32_t op_ret, int32_t ioc_create_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int32_t op_ret, int32_t op_errno, fd_t *fd, - inode_t *inode, struct stat *buf) + inode_t *inode, struct stat *buf, struct stat *preparent, + struct stat *postparent) { ioc_local_t *local = NULL; ioc_table_t *table = NULL; @@ -811,7 +812,7 @@ ioc_create_cbk (call_frame_t *frame, void *cookie, xlator_t *this, */ int32_t ioc_open (call_frame_t *frame, xlator_t *this, loc_t *loc, int32_t flags, - fd_t *fd) + fd_t *fd, int32_t wbflags) { ioc_local_t *local = NULL; @@ -830,7 +831,7 @@ ioc_open (call_frame_t *frame, xlator_t *this, loc_t *loc, int32_t flags, frame->local = local; STACK_WIND (frame, ioc_open_cbk, FIRST_CHILD(this), - FIRST_CHILD(this)->fops->open, loc, flags, fd); + FIRST_CHILD(this)->fops->open, loc, flags, fd, wbflags); return 0; } @@ -1160,7 +1161,8 @@ ioc_readv (call_frame_t *frame, xlator_t *this, fd_t *fd, */ int32_t ioc_writev_cbk (call_frame_t *frame, void *cookie, xlator_t *this, - int32_t op_ret, int32_t op_errno, struct stat *stbuf) + int32_t op_ret, int32_t op_errno, struct stat *prebuf, + struct stat *postbuf) { ioc_local_t *local = NULL; uint64_t ioc_inode = 0; @@ -1171,7 +1173,7 @@ ioc_writev_cbk (call_frame_t *frame, void *cookie, xlator_t *this, if (ioc_inode) ioc_inode_flush ((ioc_inode_t *)(long)ioc_inode); - STACK_UNWIND (frame, op_ret, op_errno, stbuf); + STACK_UNWIND (frame, op_ret, op_errno, prebuf, postbuf); return 0; } @@ -1230,13 +1232,37 @@ ioc_writev (call_frame_t *frame, xlator_t *this, fd_t *fd, */ int32_t ioc_truncate_cbk (call_frame_t *frame, void *cookie, xlator_t *this, - int32_t op_ret, int32_t op_errno, struct stat *buf) + int32_t op_ret, int32_t op_errno, struct stat *prebuf, + struct stat *postbuf) { - STACK_UNWIND (frame, op_ret, op_errno, buf); + STACK_UNWIND (frame, op_ret, op_errno, prebuf, postbuf); return 0; } + +/* + * ioc_ftruncate_cbk - + * + * @frame: + * @cookie: + * @this: + * @op_ret: + * @op_errno: + * @buf: + * + */ +int32_t +ioc_ftruncate_cbk (call_frame_t *frame, void *cookie, xlator_t *this, + int32_t op_ret, int32_t op_errno, struct stat *prebuf, + struct stat *postbuf) +{ + + STACK_UNWIND (frame, op_ret, op_errno, prebuf, postbuf); + return 0; +} + + /* * ioc_truncate - * @@ -1278,7 +1304,7 @@ ioc_ftruncate (call_frame_t *frame, xlator_t *this, fd_t *fd, off_t offset) if (ioc_inode) ioc_inode_flush ((ioc_inode_t *)(long)ioc_inode); - STACK_WIND (frame, ioc_truncate_cbk, FIRST_CHILD(this), + STACK_WIND (frame, ioc_ftruncate_cbk, FIRST_CHILD(this), FIRST_CHILD(this)->fops->ftruncate, fd, offset); return 0; } diff --git a/xlators/performance/io-threads/src/io-threads.c b/xlators/performance/io-threads/src/io-threads.c index dc4b556162c..3a7504f3275 100644 --- a/xlators/performance/io-threads/src/io-threads.c +++ b/xlators/performance/io-threads/src/io-threads.c @@ -316,7 +316,8 @@ out: int iot_lookup_cbk (call_frame_t *frame, void * cookie, xlator_t *this, int32_t op_ret, int32_t op_errno, - inode_t *inode, struct stat *buf, dict_t *xattr) + inode_t *inode, struct stat *buf, dict_t *xattr, + struct stat *postparent) { STACK_UNWIND (frame, op_ret, op_errno, inode, buf, xattr); return 0; @@ -516,7 +517,8 @@ out: int iot_readlink_cbk (call_frame_t *frame, void *cookie, xlator_t *this, - int32_t op_ret, int32_t op_errno, const char *path) + int32_t op_ret, int32_t op_errno, const char *path, + struct stat *sbuf) { STACK_UNWIND (frame, op_ret, op_errno, path); return 0; @@ -568,7 +570,8 @@ out: int iot_mknod_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int32_t op_ret, int32_t op_errno, inode_t *inode, - struct stat *buf) + struct stat *buf, struct stat *preparent, + struct stat *postparent) { STACK_UNWIND (frame, op_ret, op_errno, inode, buf); return 0; @@ -618,7 +621,8 @@ out: int iot_mkdir_cbk (call_frame_t *frame, void * cookie, xlator_t *this, int32_t op_ret, int32_t op_errno, inode_t *inode, - struct stat *buf) + struct stat *buf, struct stat *preparent, + struct stat *postparent) { STACK_UNWIND (frame, op_ret, op_errno, inode, buf); return 0; @@ -665,7 +669,8 @@ out: int iot_rmdir_cbk (call_frame_t *frame, void *cookie, xlator_t *this, - int32_t op_ret, int32_t op_errno) + int32_t op_ret, int32_t op_errno, struct stat *preparent, + struct stat *postparent) { STACK_UNWIND (frame, op_ret, op_errno); return 0; @@ -712,7 +717,8 @@ out: int iot_symlink_cbk (call_frame_t *frame, void * cookie, xlator_t *this, int32_t op_ret, int32_t op_errno, inode_t *inode, - struct stat *buf) + struct stat *buf, struct stat *preparent, + struct stat *postparent) { STACK_UNWIND (frame, op_ret, op_errno, inode, buf); return 0; @@ -762,7 +768,9 @@ out: int iot_rename_cbk (call_frame_t *frame, void * cookie, xlator_t *this, - int32_t op_ret, int32_t op_errno, struct stat *buf) + int32_t op_ret, int32_t op_errno, struct stat *buf, + struct stat *preoldparent, struct stat *postoldparent, + struct stat *prenewparent, struct stat *postnewparent) { STACK_UNWIND (frame, op_ret, op_errno, buf); return 0; @@ -820,22 +828,22 @@ iot_open_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int32_t op_ret, int iot_open_wrapper (call_frame_t * frame, xlator_t * this, loc_t *loc, - int32_t flags, fd_t * fd) + int32_t flags, fd_t * fd, int32_t wbflags) { STACK_WIND (frame, iot_open_cbk, FIRST_CHILD (this), - FIRST_CHILD (this)->fops->open, loc, flags, fd); + FIRST_CHILD (this)->fops->open, loc, flags, fd, wbflags); return 0; } int iot_open (call_frame_t *frame, xlator_t *this, loc_t *loc, int32_t flags, - fd_t *fd) + fd_t *fd, int32_t wbflags) { call_stub_t *stub = NULL; int ret = -1; - stub = fop_open_stub (frame, iot_open_wrapper, loc, flags, fd); + stub = fop_open_stub (frame, iot_open_wrapper, loc, flags, fd, wbflags); if (!stub) { gf_log (this->name, GF_LOG_ERROR, "cannot create open call stub" @@ -863,7 +871,8 @@ out: int iot_create_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int32_t op_ret, int32_t op_errno, fd_t *fd, inode_t *inode, - struct stat *stbuf) + struct stat *stbuf, struct stat *preparent, + struct stat *postparent) { STACK_UNWIND (frame, op_ret, op_errno, fd, inode, stbuf); return 0; @@ -1020,9 +1029,10 @@ out: int iot_fsync_cbk (call_frame_t *frame, void *cookie, xlator_t *this, - int32_t op_ret, int32_t op_errno) + int32_t op_ret, int32_t op_errno, struct stat *prebuf, + struct stat *postbuf) { - STACK_UNWIND (frame, op_ret, op_errno); + STACK_UNWIND (frame, op_ret, op_errno, prebuf, postbuf); return 0; } @@ -1071,9 +1081,10 @@ out: int iot_writev_cbk (call_frame_t *frame, void *cookie, xlator_t *this, - int32_t op_ret, int32_t op_errno, struct stat *stbuf) + int32_t op_ret, int32_t op_errno, struct stat *prebuf, + struct stat *postbuf) { - STACK_UNWIND (frame, op_ret, op_errno, stbuf); + STACK_UNWIND (frame, op_ret, op_errno, prebuf, postbuf); return 0; } @@ -1288,9 +1299,10 @@ out: int iot_truncate_cbk (call_frame_t *frame, void *cookie, xlator_t *this, - int32_t op_ret, int32_t op_errno, struct stat *buf) + int32_t op_ret, int32_t op_errno, struct stat *prebuf, + struct stat *postbuf) { - STACK_UNWIND (frame, op_ret, op_errno, buf); + STACK_UNWIND (frame, op_ret, op_errno, prebuf, postbuf); return 0; } @@ -1349,9 +1361,10 @@ out: int iot_ftruncate_cbk (call_frame_t *frame, void *cookie, xlator_t *this, - int32_t op_ret, int32_t op_errno, struct stat *buf) + int32_t op_ret, int32_t op_errno, struct stat *prebuf, + struct stat *postbuf) { - STACK_UNWIND (frame, op_ret, op_errno, buf); + STACK_UNWIND (frame, op_ret, op_errno, prebuf, postbuf); return 0; } @@ -1450,7 +1463,8 @@ out: int iot_unlink_cbk (call_frame_t *frame, void *cookie, xlator_t *this, - int32_t op_ret, int32_t op_errno) + int32_t op_ret, int32_t op_errno, struct stat *preparent, + struct stat *postparent) { STACK_UNWIND (frame, op_ret, op_errno); return 0; @@ -1503,7 +1517,7 @@ out: int iot_link_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int32_t op_ret, int32_t op_errno, inode_t *inode, - struct stat *buf) + struct stat *buf, struct stat *preparent, struct stat *postparent) { STACK_UNWIND (frame, op_ret, op_errno, inode, buf); return 0; diff --git a/xlators/performance/quick-read/src/quick-read.c b/xlators/performance/quick-read/src/quick-read.c index 1249da87b20..3e732e51a0a 100644 --- a/xlators/performance/quick-read/src/quick-read.c +++ b/xlators/performance/quick-read/src/quick-read.c @@ -149,7 +149,7 @@ out: int32_t qr_lookup_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int32_t op_ret, int32_t op_errno, inode_t *inode, - struct stat *buf, dict_t *dict) + struct stat *buf, dict_t *dict, struct stat *postparent) { data_t *content = NULL; qr_file_t *qr_file = NULL; @@ -415,7 +415,7 @@ out: int32_t qr_open (call_frame_t *frame, xlator_t *this, loc_t *loc, int32_t flags, - fd_t *fd) + fd_t *fd, int32_t wbflags) { qr_file_t *qr_file = NULL; int32_t ret = -1; @@ -516,7 +516,7 @@ unwind: wind: STACK_WIND (frame, qr_open_cbk, FIRST_CHILD(this), - FIRST_CHILD(this)->fops->open, loc, flags, fd); + FIRST_CHILD(this)->fops->open, loc, flags, fd, wbflags); return 0; } @@ -709,7 +709,7 @@ qr_validate_cache (call_frame_t *frame, xlator_t *this, fd_t *fd, STACK_WIND (frame, qr_open_cbk, FIRST_CHILD(this), FIRST_CHILD(this)->fops->open, - &loc, flags, fd); + &loc, flags, fd, 0); qr_loc_wipe (&loc); } else if (can_wind) { @@ -949,7 +949,7 @@ out: STACK_WIND (frame, qr_open_cbk, FIRST_CHILD(this), FIRST_CHILD(this)->fops->open, - &loc, flags, fd); + &loc, flags, fd, 0); qr_loc_wipe (&loc); } else if (can_wind) { @@ -974,10 +974,11 @@ out: int32_t -qr_writev_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int32_t op_ret, - int32_t op_errno, struct stat *stbuf) +qr_writev_cbk (call_frame_t *frame, void *cookie, xlator_t *this, + int32_t op_ret, int32_t op_errno, struct stat *prebuf, + struct stat *postbuf) { - STACK_UNWIND (frame, op_ret, op_errno, stbuf); + STACK_UNWIND (frame, op_ret, op_errno, prebuf, postbuf); return 0; } @@ -1081,7 +1082,7 @@ out: } STACK_WIND (frame, qr_open_cbk, FIRST_CHILD(this), - FIRST_CHILD(this)->fops->open, &loc, flags, fd); + FIRST_CHILD(this)->fops->open, &loc, flags, fd, 0); qr_loc_wipe (&loc); } @@ -1174,7 +1175,7 @@ out: } STACK_WIND (frame, qr_open_cbk, FIRST_CHILD(this), - FIRST_CHILD(this)->fops->open, &loc, flags, fd); + FIRST_CHILD(this)->fops->open, &loc, flags, fd, 0); qr_loc_wipe (&loc); } @@ -1274,7 +1275,7 @@ out: } STACK_WIND (frame, qr_open_cbk, FIRST_CHILD(this), - FIRST_CHILD(this)->fops->open, &loc, flags, fd); + FIRST_CHILD(this)->fops->open, &loc, flags, fd, 0); qr_loc_wipe (&loc); } @@ -1372,7 +1373,7 @@ out: STACK_WIND (frame, qr_open_cbk, FIRST_CHILD(this), FIRST_CHILD(this)->fops->open, &loc, open_flags, - fd); + fd, 0); qr_loc_wipe (&loc); } @@ -1472,7 +1473,7 @@ out: } STACK_WIND (frame, qr_open_cbk, FIRST_CHILD(this), - FIRST_CHILD(this)->fops->open, &loc, flags, fd); + FIRST_CHILD(this)->fops->open, &loc, flags, fd, 0); qr_loc_wipe (&loc); } @@ -1644,7 +1645,7 @@ out: } STACK_WIND (frame, qr_open_cbk, FIRST_CHILD(this), - FIRST_CHILD(this)->fops->open, &loc, flags, fd); + FIRST_CHILD(this)->fops->open, &loc, flags, fd, 0); qr_loc_wipe (&loc); } @@ -1743,7 +1744,7 @@ out: } STACK_WIND (frame, qr_open_cbk, FIRST_CHILD(this), - FIRST_CHILD(this)->fops->open, &loc, flags, fd); + FIRST_CHILD(this)->fops->open, &loc, flags, fd, 0); qr_loc_wipe (&loc); } @@ -1754,9 +1755,9 @@ out: int32_t qr_fsync_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int32_t op_ret, - int32_t op_errno) + int32_t op_errno, struct stat *prebuf, struct stat *postbuf) { - STACK_UNWIND (frame, op_ret, op_errno); + STACK_UNWIND (frame, op_ret, op_errno, prebuf, postbuf); return 0; } @@ -1836,7 +1837,7 @@ out: STACK_WIND (frame, qr_open_cbk, FIRST_CHILD(this), FIRST_CHILD(this)->fops->open, &loc, open_flags, - fd); + fd, 0); qr_loc_wipe (&loc); } @@ -1847,7 +1848,8 @@ out: int32_t qr_ftruncate_cbk (call_frame_t *frame, void *cookie, xlator_t *this, - int32_t op_ret, int32_t op_errno, struct stat *buf) + int32_t op_ret, int32_t op_errno, struct stat *prebuf, + struct stat *postbuf) { int32_t ret = 0; uint64_t value = 0; @@ -1873,7 +1875,8 @@ qr_ftruncate_cbk (call_frame_t *frame, void *cookie, xlator_t *this, if (qr_file) { LOCK (&qr_file->lock); { - if (qr_file->stbuf.st_size != buf->st_size) { + if (qr_file->stbuf.st_size != postbuf->st_size) + { dict_unref (qr_file->xattr); qr_file->xattr = NULL; } @@ -1883,7 +1886,7 @@ qr_ftruncate_cbk (call_frame_t *frame, void *cookie, xlator_t *this, } out: - STACK_UNWIND (frame, op_ret, op_errno, buf); + STACK_UNWIND (frame, op_ret, op_errno, prebuf, postbuf); return 0; } @@ -1977,7 +1980,7 @@ out: } STACK_WIND (frame, qr_open_cbk, FIRST_CHILD(this), - FIRST_CHILD(this)->fops->open, &loc, flags, fd); + FIRST_CHILD(this)->fops->open, &loc, flags, fd, 0); qr_loc_wipe (&loc); } @@ -2073,7 +2076,7 @@ out: } STACK_WIND (frame, qr_open_cbk, FIRST_CHILD(this), - FIRST_CHILD(this)->fops->open, &loc, flags, fd); + FIRST_CHILD(this)->fops->open, &loc, flags, fd, 0); qr_loc_wipe (&loc); } diff --git a/xlators/performance/read-ahead/src/read-ahead.c b/xlators/performance/read-ahead/src/read-ahead.c index 6d1c5a2bcfa..a6b6f2f254b 100644 --- a/xlators/performance/read-ahead/src/read-ahead.c +++ b/xlators/performance/read-ahead/src/read-ahead.c @@ -112,7 +112,8 @@ unwind: int ra_create_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int32_t op_ret, int32_t op_errno, fd_t *fd, inode_t *inode, - struct stat *buf) + struct stat *buf, struct stat *preparent, + struct stat *postparent) { ra_conf_t *conf = NULL; ra_file_t *file = NULL; @@ -177,12 +178,12 @@ unwind: int ra_open (call_frame_t *frame, xlator_t *this, loc_t *loc, int32_t flags, - fd_t *fd) + fd_t *fd, int32_t wbflags) { STACK_WIND (frame, ra_open_cbk, FIRST_CHILD (this), FIRST_CHILD (this)->fops->open, - loc, flags, fd); + loc, flags, fd, wbflags); return 0; } @@ -525,6 +526,16 @@ ra_flush_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int32_t op_ret, } + +int +ra_fsync_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int32_t op_ret, + int32_t op_errno, struct stat *prebuf, struct stat *postbuf) +{ + STACK_UNWIND (frame, op_ret, op_errno, prebuf, postbuf); + return 0; +} + + int ra_flush (call_frame_t *frame, xlator_t *this, fd_t *fd) { @@ -577,7 +588,7 @@ ra_fsync (call_frame_t *frame, xlator_t *this, fd_t *fd, int32_t datasync) flush_region (frame, file, 0, file->pages.prev->offset+1); } - STACK_WIND (frame, ra_flush_cbk, + STACK_WIND (frame, ra_fsync_cbk, FIRST_CHILD (this), FIRST_CHILD (this)->fops->fsync, fd, datasync); @@ -591,7 +602,8 @@ unwind: int ra_writev_cbk (call_frame_t *frame, void *cookie, xlator_t *this, - int32_t op_ret, int32_t op_errno, struct stat *stbuf) + int32_t op_ret, int32_t op_errno, struct stat *prebuf, + struct stat *postbuf) { fd_t *fd = NULL; ra_file_t *file = NULL; @@ -606,7 +618,7 @@ ra_writev_cbk (call_frame_t *frame, void *cookie, xlator_t *this, flush_region (frame, file, 0, file->pages.prev->offset+1); frame->local = NULL; - STACK_UNWIND (frame, op_ret, op_errno, stbuf); + STACK_UNWIND (frame, op_ret, op_errno, prebuf, postbuf); return 0; } @@ -650,6 +662,16 @@ unwind: int +ra_truncate_cbk (call_frame_t *frame, void *cookie, xlator_t *this, + int32_t op_ret, int32_t op_errno, struct stat *prebuf, + struct stat *postbuf) +{ + STACK_UNWIND (frame, op_ret, op_errno, prebuf, postbuf); + return 0; +} + + +int ra_attr_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int32_t op_ret, int32_t op_errno, struct stat *buf) { @@ -683,7 +705,7 @@ ra_truncate (call_frame_t *frame, xlator_t *this, loc_t *loc, off_t offset) } UNLOCK (&inode->lock); - STACK_WIND (frame, ra_attr_cbk, + STACK_WIND (frame, ra_truncate_cbk, FIRST_CHILD (this), FIRST_CHILD (this)->fops->truncate, loc, offset); @@ -748,7 +770,7 @@ ra_ftruncate (call_frame_t *frame, xlator_t *this, fd_t *fd, off_t offset) } UNLOCK (&inode->lock); - STACK_WIND (frame, ra_attr_cbk, + STACK_WIND (frame, ra_truncate_cbk, FIRST_CHILD (this), FIRST_CHILD (this)->fops->ftruncate, fd, offset); diff --git a/xlators/performance/stat-prefetch/src/stat-prefetch.c b/xlators/performance/stat-prefetch/src/stat-prefetch.c index 67a61fc47e7..e2771314a7a 100644 --- a/xlators/performance/stat-prefetch/src/stat-prefetch.c +++ b/xlators/performance/stat-prefetch/src/stat-prefetch.c @@ -362,7 +362,7 @@ unlock: int32_t sp_lookup_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int32_t op_ret, int32_t op_errno, inode_t *inode, - struct stat *buf, dict_t *dict) + struct stat *buf, dict_t *dict, struct stat *postparent) { struct stat *stbuf = NULL; int32_t ret = -1; @@ -401,7 +401,7 @@ out: int32_t sp_lookup_behind_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int32_t op_ret, int32_t op_errno, inode_t *inode, - struct stat *buf, dict_t *dict) + struct stat *buf, dict_t *dict, struct stat *postparent) { sp_local_t *local = NULL; sp_cache_t *cache = NULL; @@ -672,10 +672,24 @@ unwind: int32_t -sp_stbuf_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int32_t op_ret, - int32_t op_errno, struct stat *buf) +sp_truncate_cbk (call_frame_t *frame, void *cookie, xlator_t *this, + int32_t op_ret, int32_t op_errno, struct stat *prebuf, + struct stat *postbuf) { - SP_STACK_UNWIND (frame, op_ret, op_errno, buf); + SP_STACK_UNWIND (frame, op_ret, op_errno, prebuf, postbuf); + return 0; +} + + + +int32_t +sp_rename_cbk (call_frame_t *frame, void *cookie, xlator_t *this, + int32_t op_ret, int32_t op_errno, struct stat *buf, + struct stat *preoldparent, struct stat *postoldparent, + struct stat *prenewparent, struct stat *postnewparent) +{ + SP_STACK_UNWIND (frame, op_ret, op_errno, buf, preoldparent, + postoldparent, prenewparent, postnewparent); return 0; } @@ -712,7 +726,7 @@ out: int32_t sp_open (call_frame_t *frame, xlator_t *this, loc_t *loc, int32_t flags, - fd_t *fd) + fd_t *fd, int wbflags) { sp_local_t *local = NULL; int32_t ret = -1; @@ -728,7 +742,7 @@ sp_open (call_frame_t *frame, xlator_t *this, loc_t *loc, int32_t flags, } STACK_WIND (frame, sp_fd_cbk, FIRST_CHILD(this), - FIRST_CHILD(this)->fops->open, loc, flags, fd); + FIRST_CHILD(this)->fops->open, loc, flags, fd, wbflags); return 0; unwind: @@ -740,7 +754,8 @@ unwind: static int32_t sp_create_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int32_t op_ret, int32_t op_errno, fd_t *fd, inode_t *inode, - struct stat *buf) + struct stat *buf, struct stat *preparent, + struct stat *postparent) { sp_local_t *local = NULL; sp_fd_ctx_t *fd_ctx = NULL; @@ -837,9 +852,11 @@ unwind: int32_t sp_new_entry_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int32_t op_ret, int32_t op_errno, inode_t *inode, - struct stat *buf) + struct stat *buf, struct stat *preparent, + struct stat *postparent) { - STACK_UNWIND (frame, op_ret, op_errno, inode, buf); + STACK_UNWIND (frame, op_ret, op_errno, inode, buf, preparent, + postparent); return 0; } @@ -972,7 +989,7 @@ sp_truncate (call_frame_t *frame, xlator_t *this, loc_t *loc, off_t offset) sp_cache_remove_entry (cache, (char *)loc->name, 0); } - STACK_WIND (frame, sp_stbuf_cbk, FIRST_CHILD(this), + STACK_WIND (frame, sp_truncate_cbk, FIRST_CHILD(this), FIRST_CHILD(this)->fops->truncate, loc, offset); return 0; @@ -1007,7 +1024,7 @@ sp_ftruncate (call_frame_t *frame, xlator_t *this, fd_t *fd, off_t offset) sp_cache_remove_entry (cache, name, 0); } - STACK_WIND (frame, sp_stbuf_cbk, FIRST_CHILD(this), + STACK_WIND (frame, sp_truncate_cbk, FIRST_CHILD(this), FIRST_CHILD(this)->fops->ftruncate, fd, offset); return 0; @@ -1054,9 +1071,10 @@ unwind: int32_t sp_readlink_cbk (call_frame_t *frame, void *cookie, xlator_t *this, - int32_t op_ret, int32_t op_errno, const char *path) + int32_t op_ret, int32_t op_errno, const char *path, + struct stat *buf) { - SP_STACK_UNWIND (frame, op_ret, op_errno, path); + SP_STACK_UNWIND (frame, op_ret, op_errno, path, buf); return 0; } @@ -1084,6 +1102,16 @@ unwind: return 0; } +int32_t +sp_unlink_cbk (call_frame_t *frame, void *cookie, xlator_t *this, + int32_t op_ret, int32_t op_errno, struct stat *preparent, + struct stat *postparent) +{ + SP_STACK_UNWIND (frame, op_ret, op_errno, preparent, postparent); + return 0; +} + + int32_t sp_err_cbk (call_frame_t *frame, void *cookie, xlator_t *this, @@ -1115,7 +1143,7 @@ sp_unlink (call_frame_t *frame, xlator_t *this, loc_t *loc) goto unwind; } - STACK_WIND (frame, sp_err_cbk, FIRST_CHILD(this), + STACK_WIND (frame, sp_unlink_cbk, FIRST_CHILD(this), FIRST_CHILD(this)->fops->unlink, loc); return 0; @@ -1169,7 +1197,7 @@ sp_rmdir (call_frame_t *frame, xlator_t *this, loc_t *loc) goto unwind; } - STACK_WIND (frame, sp_err_cbk, FIRST_CHILD(this), + STACK_WIND (frame, sp_unlink_cbk, FIRST_CHILD(this), FIRST_CHILD(this)->fops->rmdir, loc); return 0; @@ -1251,7 +1279,7 @@ sp_writev (call_frame_t *frame, xlator_t *this, fd_t *fd, struct iovec *vector, sp_cache_remove_entry (cache, name, 0); } - STACK_WIND (frame, sp_stbuf_cbk, FIRST_CHILD(this), + STACK_WIND (frame, sp_unlink_cbk, FIRST_CHILD(this), FIRST_CHILD(this)->fops->writev, fd, vector, count, off, iobref); return 0; @@ -1287,7 +1315,7 @@ sp_fsync (call_frame_t *frame, xlator_t *this, fd_t *fd, int32_t flags) sp_cache_remove_entry (cache, name, 0); } - STACK_WIND (frame, sp_err_cbk, FIRST_CHILD(this), + STACK_WIND (frame, sp_unlink_cbk, FIRST_CHILD(this), FIRST_CHILD(this)->fops->fsync, fd, flags); return 0; @@ -1338,7 +1366,7 @@ sp_rename (call_frame_t *frame, xlator_t *this, loc_t *oldloc,loc_t *newloc) sp_remove_caches_from_all_fds_opened (this, oldloc->inode); } - STACK_WIND (frame, sp_stbuf_cbk, FIRST_CHILD(this), + STACK_WIND (frame, sp_rename_cbk, FIRST_CHILD(this), FIRST_CHILD(this)->fops->rename, oldloc, newloc); return 0; diff --git a/xlators/performance/symlink-cache/src/symlink-cache.c b/xlators/performance/symlink-cache/src/symlink-cache.c index ad0836c5eb2..791fde3c509 100644 --- a/xlators/performance/symlink-cache/src/symlink-cache.c +++ b/xlators/performance/symlink-cache/src/symlink-cache.c @@ -242,7 +242,7 @@ sc_cache_get (xlator_t *this, inode_t *inode, char **link) int sc_readlink_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int op_ret, int op_errno, - const char *link) + const char *link, struct stat *sbuf) { if (op_ret > 0) sc_cache_update (this, frame->local, link); @@ -287,7 +287,8 @@ sc_readlink (call_frame_t *frame, xlator_t *this, int sc_symlink_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int op_ret, int op_errno, - inode_t *inode, struct stat *buf) + inode_t *inode, struct stat *buf, struct stat *preparent, + struct stat *postparent) { if (op_ret == 0) { if (frame->local) { @@ -318,7 +319,8 @@ sc_symlink (call_frame_t *frame, xlator_t *this, int sc_lookup_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int op_ret, int op_errno, - inode_t *inode, struct stat *buf, dict_t *xattr) + inode_t *inode, struct stat *buf, dict_t *xattr, + struct stat *postparent) { if (op_ret == 0) sc_cache_validate (this, inode, buf); diff --git a/xlators/performance/write-behind/src/write-behind.c b/xlators/performance/write-behind/src/write-behind.c index 300d684659e..57311f6d498 100644 --- a/xlators/performance/write-behind/src/write-behind.c +++ b/xlators/performance/write-behind/src/write-behind.c @@ -310,7 +310,7 @@ wb_file_destroy (wb_file_t *file) int32_t wb_sync_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int32_t op_ret, - int32_t op_errno, struct stat *stbuf) + int32_t op_errno, struct stat *prebuf, struct stat *postbuf) { wb_local_t *local = NULL; list_head_t *winds = NULL; @@ -774,7 +774,8 @@ wb_fstat (call_frame_t *frame, xlator_t *this, fd_t *fd) int32_t wb_truncate_cbk (call_frame_t *frame, void *cookie, xlator_t *this, - int32_t op_ret, int32_t op_errno, struct stat *buf) + int32_t op_ret, int32_t op_errno, struct stat *prebuf, + struct stat *postbuf) { wb_local_t *local = NULL; wb_request_t *request = NULL; @@ -795,7 +796,7 @@ wb_truncate_cbk (call_frame_t *frame, void *cookie, xlator_t *this, } } - STACK_UNWIND (frame, op_ret, op_errno, buf); + STACK_UNWIND (frame, op_ret, op_errno, prebuf, postbuf); if (request) { wb_request_unref (request); @@ -916,7 +917,8 @@ wb_truncate (call_frame_t *frame, xlator_t *this, loc_t *loc, off_t offset) int32_t wb_ftruncate_cbk (call_frame_t *frame, void *cookie, xlator_t *this, - int32_t op_ret, int32_t op_errno, struct stat *buf) + int32_t op_ret, int32_t op_errno, struct stat *prebuf, + struct stat *postbuf) { wb_local_t *local = NULL; wb_request_t *request = NULL; @@ -936,7 +938,7 @@ wb_ftruncate_cbk (call_frame_t *frame, void *cookie, xlator_t *this, } } - STACK_UNWIND (frame, op_ret, op_errno, buf); + STACK_UNWIND (frame, op_ret, op_errno, prebuf, postbuf); return 0; } @@ -1211,7 +1213,7 @@ wb_open_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int32_t op_ret, int32_t wb_open (call_frame_t *frame, xlator_t *this, loc_t *loc, int32_t flags, - fd_t *fd) + fd_t *fd, int32_t wbflags) { frame->local = (void *)(long)flags; @@ -1219,7 +1221,7 @@ wb_open (call_frame_t *frame, xlator_t *this, loc_t *loc, int32_t flags, wb_open_cbk, FIRST_CHILD(this), FIRST_CHILD(this)->fops->open, - loc, flags, fd); + loc, flags, fd, wbflags); return 0; } @@ -1227,7 +1229,8 @@ wb_open (call_frame_t *frame, xlator_t *this, loc_t *loc, int32_t flags, int32_t wb_create_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int32_t op_ret, int32_t op_errno, fd_t *fd, inode_t *inode, - struct stat *buf) + struct stat *buf, struct stat *preparent, + struct stat *postparent) { long flags = 0; wb_file_t *file = NULL; @@ -1702,9 +1705,10 @@ out: int32_t wb_writev_cbk (call_frame_t *frame, void *cookie, xlator_t *this, - int32_t op_ret, int32_t op_errno, struct stat *stbuf) + int32_t op_ret, int32_t op_errno, struct stat *prebuf, + struct stat *postbuf) { - STACK_UNWIND (frame, op_ret, op_errno, stbuf); + STACK_UNWIND (frame, op_ret, op_errno, prebuf, postbuf); return 0; } @@ -2124,7 +2128,7 @@ wb_flush (call_frame_t *frame, xlator_t *this, fd_t *fd) static int32_t wb_fsync_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int32_t op_ret, - int32_t op_errno) + int32_t op_errno, struct stat *prebuf, struct stat *postbuf) { wb_local_t *local = NULL; wb_file_t *file = NULL; diff --git a/xlators/protocol/client/src/client-protocol.c b/xlators/protocol/client/src/client-protocol.c index 43f99770678..b3014463fa1 100644 --- a/xlators/protocol/client/src/client-protocol.c +++ b/xlators/protocol/client/src/client-protocol.c @@ -708,7 +708,7 @@ unwind: int client_open (call_frame_t *frame, xlator_t *this, loc_t *loc, int32_t flags, - fd_t *fd) + fd_t *fd, int32_t wbflags) { int ret = -1; gf_hdr_common_t *hdr = NULL; @@ -744,6 +744,7 @@ client_open (call_frame_t *frame, xlator_t *this, loc_t *loc, int32_t flags, req->ino = hton64 (ino); req->flags = hton32 (gf_flags_from_flags (flags)); + req->wbflags = hton32 (wbflags); strcpy (req->path, loc->path); ret = protocol_client_xfer (frame, this, @@ -3941,7 +3942,7 @@ client_truncate_cbk (call_frame_t *frame, gf_hdr_common_t *hdr, size_t hdrlen, op_errno = gf_error_to_errno (ntoh32 (hdr->rsp.op_errno)); if (op_ret == 0) { - gf_stat_to_stat (&rsp->stat, &stbuf); + gf_stat_to_stat (&rsp->prestat, &stbuf); } STACK_UNWIND (frame, op_ret, op_errno, &stbuf); @@ -4001,7 +4002,7 @@ client_ftruncate_cbk (call_frame_t *frame, gf_hdr_common_t *hdr, size_t hdrlen, op_errno = gf_error_to_errno (ntoh32 (hdr->rsp.op_errno)); if (op_ret == 0) { - gf_stat_to_stat (&rsp->stat, &stbuf); + gf_stat_to_stat (&rsp->prestat, &stbuf); } STACK_UNWIND (frame, op_ret, op_errno, &stbuf); @@ -4078,7 +4079,7 @@ client_write_cbk (call_frame_t *frame, gf_hdr_common_t *hdr, size_t hdrlen, op_errno = gf_error_to_errno (ntoh32 (hdr->rsp.op_errno)); if (op_ret >= 0) - gf_stat_to_stat (&rsp->stat, &stbuf); + gf_stat_to_stat (&rsp->poststat, &stbuf); STACK_UNWIND (frame, op_ret, op_errno, &stbuf); diff --git a/xlators/protocol/server/src/server-dentry.c b/xlators/protocol/server/src/server-dentry.c index d3a69a393fc..940bc3bee56 100644 --- a/xlators/protocol/server/src/server-dentry.c +++ b/xlators/protocol/server/src/server-dentry.c @@ -218,7 +218,8 @@ __do_path_resolve_cbk (call_frame_t *frame, int32_t op_errno, inode_t *inode, struct stat *stbuf, - dict_t *dict) + dict_t *dict, + struct stat *postparent) { server_state_t *state = NULL; call_stub_t *stub = NULL; diff --git a/xlators/protocol/server/src/server-protocol.c b/xlators/protocol/server/src/server-protocol.c index 8e4e9e7251e..a37f4da4313 100644 --- a/xlators/protocol/server/src/server-protocol.c +++ b/xlators/protocol/server/src/server-protocol.c @@ -405,7 +405,8 @@ server_access_cbk (call_frame_t *frame, void *cookie, xlator_t *this, */ int server_rmdir_cbk (call_frame_t *frame, void *cookie, xlator_t *this, - int32_t op_ret, int32_t op_errno) + int32_t op_ret, int32_t op_errno, struct stat *preparent, + struct stat *postparent) { gf_hdr_common_t *hdr = NULL; gf_fop_rmdir_rsp_t *rsp = NULL; @@ -435,6 +436,11 @@ server_rmdir_cbk (call_frame_t *frame, void *cookie, xlator_t *this, gf_errno = gf_errno_to_error (op_errno); hdr->rsp.op_errno = hton32 (gf_errno); + if (op_ret == 0) { + gf_stat_from_stat (&rsp->preparent, preparent); + gf_stat_from_stat (&rsp->postparent, postparent); + } + server_loc_wipe (&(state->loc)); protocol_server_reply (frame, GF_OP_TYPE_FOP_REPLY, GF_FOP_RMDIR, @@ -457,7 +463,8 @@ server_rmdir_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int server_mkdir_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int32_t op_ret, int32_t op_errno, inode_t *inode, - struct stat *stbuf) + struct stat *stbuf, struct stat *preparent, + struct stat *postparent) { gf_hdr_common_t *hdr = NULL; gf_fop_mkdir_rsp_t *rsp = NULL; @@ -508,7 +515,8 @@ server_mkdir_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int server_mknod_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int32_t op_ret, int32_t op_errno, - inode_t *inode, struct stat *stbuf) + inode_t *inode, struct stat *stbuf, struct stat *preparent, + struct stat *postparent) { gf_hdr_common_t *hdr = NULL; gf_fop_mknod_rsp_t *rsp = NULL; @@ -1116,7 +1124,9 @@ server_fsetxattr_cbk (call_frame_t *frame, void *cookie, xlator_t *this, */ int server_rename_cbk (call_frame_t *frame, void *cookie, xlator_t *this, - int32_t op_ret, int32_t op_errno, struct stat *stbuf) + int32_t op_ret, int32_t op_errno, struct stat *stbuf, + struct stat *preoldparent, struct stat *postoldparent, + struct stat *prenewparent, struct stat *postnewparent) { gf_hdr_common_t *hdr = NULL; gf_fop_rename_rsp_t *rsp = NULL; @@ -1174,7 +1184,8 @@ server_rename_cbk (call_frame_t *frame, void *cookie, xlator_t *this, */ int server_unlink_cbk (call_frame_t *frame, void *cookie, xlator_t *this, - int32_t op_ret, int32_t op_errno) + int32_t op_ret, int32_t op_errno, struct stat *preparent, + struct stat *postparent) { gf_hdr_common_t *hdr = NULL; gf_fop_unlink_rsp_t *rsp = NULL; @@ -1210,6 +1221,11 @@ server_unlink_cbk (call_frame_t *frame, void *cookie, xlator_t *this, gf_errno = gf_errno_to_error (op_errno); hdr->rsp.op_errno = hton32 (gf_errno); + if (op_ret == 0) { + gf_stat_from_stat (&rsp->preparent, preparent); + gf_stat_from_stat (&rsp->postparent, postparent); + } + server_loc_wipe (&(state->loc)); protocol_server_reply (frame, GF_OP_TYPE_FOP_REPLY, GF_FOP_UNLINK, @@ -1231,7 +1247,8 @@ server_unlink_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int server_symlink_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int32_t op_ret, int32_t op_errno, inode_t *inode, - struct stat *stbuf) + struct stat *stbuf, struct stat *preparent, + struct stat *postparent) { gf_hdr_common_t *hdr = NULL; gf_fop_symlink_rsp_t *rsp = NULL; @@ -1283,7 +1300,8 @@ server_symlink_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int server_link_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int32_t op_ret, int32_t op_errno, inode_t *inode, - struct stat *stbuf) + struct stat *stbuf, struct stat *preparent, + struct stat *postparent) { gf_hdr_common_t *hdr = NULL; gf_fop_link_rsp_t *rsp = NULL; @@ -1347,7 +1365,8 @@ server_link_cbk (call_frame_t *frame, void *cookie, xlator_t *this, */ int server_truncate_cbk (call_frame_t *frame, void *cookie, xlator_t *this, - int32_t op_ret, int32_t op_errno, struct stat *stbuf) + int32_t op_ret, int32_t op_errno, struct stat *prebuf, + struct stat *postbuf) { gf_hdr_common_t *hdr = NULL; gf_fop_truncate_rsp_t *rsp = NULL; @@ -1366,7 +1385,7 @@ server_truncate_cbk (call_frame_t *frame, void *cookie, xlator_t *this, hdr->rsp.op_errno = hton32 (gf_errno); if (op_ret == 0) { - gf_stat_from_stat (&rsp->stat, stbuf); + gf_stat_from_stat (&rsp->prestat, prebuf); } else { gf_log (this->name, GF_LOG_DEBUG, "%"PRId64": TRUNCATE %s (%"PRId64") ==> %"PRId32" (%s)", @@ -1443,7 +1462,8 @@ server_fstat_cbk (call_frame_t *frame, void *cookie, xlator_t *this, */ int server_ftruncate_cbk (call_frame_t *frame, void *cookie, xlator_t *this, - int32_t op_ret, int32_t op_errno, struct stat *stbuf) + int32_t op_ret, int32_t op_errno, struct stat *prebuf, + struct stat *postbuf) { gf_hdr_common_t *hdr = NULL; gf_fop_ftruncate_rsp_t *rsp = NULL; @@ -1460,7 +1480,7 @@ server_ftruncate_cbk (call_frame_t *frame, void *cookie, xlator_t *this, hdr->rsp.op_errno = hton32 (gf_errno); if (op_ret == 0) { - gf_stat_from_stat (&rsp->stat, stbuf); + gf_stat_from_stat (&rsp->prestat, prebuf); } else { state = CALL_STATE (frame); @@ -1533,7 +1553,8 @@ server_flush_cbk (call_frame_t *frame, void *cookie, xlator_t *this, */ int server_fsync_cbk (call_frame_t *frame, void *cookie, xlator_t *this, - int32_t op_ret, int32_t op_errno) + int32_t op_ret, int32_t op_errno, struct stat *prebuf, + struct stat *postbuf) { gf_hdr_common_t *hdr = NULL; gf_fop_fsync_rsp_t *rsp = NULL; @@ -1610,7 +1631,8 @@ server_release_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int server_writev_cbk (call_frame_t *frame, void *cookie, xlator_t *this, - int32_t op_ret, int32_t op_errno, struct stat *stbuf) + int32_t op_ret, int32_t op_errno, struct stat *prebuf, + struct stat *postbuf) { gf_hdr_common_t *hdr = NULL; gf_fop_write_rsp_t *rsp = NULL; @@ -1627,7 +1649,7 @@ server_writev_cbk (call_frame_t *frame, void *cookie, xlator_t *this, hdr->rsp.op_errno = hton32 (gf_errno_to_error (op_errno)); if (op_ret >= 0) { - gf_stat_from_stat (&rsp->stat, stbuf); + gf_stat_from_stat (&rsp->poststat, postbuf); } else { state = CALL_STATE(frame); @@ -1772,7 +1794,8 @@ server_open_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int server_create_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int32_t op_ret, int32_t op_errno, - fd_t *fd, inode_t *inode, struct stat *stbuf) + fd_t *fd, inode_t *inode, struct stat *stbuf, + struct stat *preparent, struct stat *postparent) { server_connection_t *conn = NULL; gf_hdr_common_t *hdr = NULL; @@ -1848,7 +1871,8 @@ server_create_cbk (call_frame_t *frame, void *cookie, xlator_t *this, */ int server_readlink_cbk (call_frame_t *frame, void *cookie, xlator_t *this, - int32_t op_ret, int32_t op_errno, const char *buf) + int32_t op_ret, int32_t op_errno, const char *buf, + struct stat *sbuf) { gf_hdr_common_t *hdr = NULL; gf_fop_readlink_rsp_t *rsp = NULL; @@ -2064,7 +2088,8 @@ server_fsetattr_cbk (call_frame_t *frame, int server_lookup_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int32_t op_ret, int32_t op_errno, - inode_t *inode, struct stat *stbuf, dict_t *dict) + inode_t *inode, struct stat *stbuf, dict_t *dict, + struct stat *postparent) { gf_hdr_common_t *hdr = NULL; gf_fop_lookup_rsp_t *rsp = NULL; @@ -2346,7 +2371,8 @@ server_stub_resume (call_stub_t *stub, int32_t op_ret, int32_t op_errno, */ server_rename_cbk (stub->frame, NULL, stub->frame->this, - -1, ENOENT, NULL); + -1, ENOENT, NULL, NULL, NULL, NULL, + NULL); server_loc_wipe (&stub->args.rename.old); server_loc_wipe (&stub->args.rename.new); FREE (stub); @@ -2438,7 +2464,7 @@ server_stub_resume (call_stub_t *stub, int32_t op_ret, int32_t op_errno, server_lookup_cbk (stub->frame, NULL, stub->frame->this, -1, ENOENT, - NULL, NULL, NULL); + NULL, NULL, NULL, NULL); server_loc_wipe (&stub->args.lookup.loc); FREE (stub); return 0; @@ -2528,7 +2554,8 @@ server_stub_resume (call_stub_t *stub, int32_t op_ret, int32_t op_errno, BOUND_XL(stub->frame)->name, op_ret, op_errno); server_unlink_cbk (stub->frame, NULL, - stub->frame->this, -1, ENOENT); + stub->frame->this, -1, ENOENT, NULL, + NULL); server_loc_wipe (&stub->args.unlink.loc); FREE (stub); return 0; @@ -2558,7 +2585,7 @@ server_stub_resume (call_stub_t *stub, int32_t op_ret, int32_t op_errno, op_ret, op_errno); server_symlink_cbk (stub->frame, NULL, stub->frame->this, -1, ENOENT, - NULL, NULL); + NULL, NULL, NULL, NULL); server_loc_wipe (&stub->args.symlink.loc); FREE (stub); return 0; @@ -2587,7 +2614,7 @@ server_stub_resume (call_stub_t *stub, int32_t op_ret, int32_t op_errno, BOUND_XL(stub->frame)->name, op_ret, op_errno); server_rmdir_cbk (stub->frame, NULL, stub->frame->this, - -1, ENOENT); + -1, ENOENT, NULL, NULL); server_loc_wipe (&stub->args.rmdir.loc); FREE (stub); return 0; @@ -2621,7 +2648,7 @@ server_stub_resume (call_stub_t *stub, int32_t op_ret, int32_t op_errno, server_link_cbk (stub->frame, NULL, stub->frame->this, -1, ENOENT, - NULL, NULL); + NULL, NULL, NULL, NULL); server_loc_wipe (&stub->args.link.oldloc); server_loc_wipe (&stub->args.link.newloc); FREE (stub); @@ -2659,7 +2686,7 @@ server_stub_resume (call_stub_t *stub, int32_t op_ret, int32_t op_errno, server_link_cbk (stub->frame, NULL, stub->frame->this, -1, ENOENT, - NULL, NULL); + NULL, NULL, NULL, NULL); server_loc_wipe (&stub->args.link.oldloc); server_loc_wipe (&stub->args.link.newloc); @@ -2698,7 +2725,7 @@ server_stub_resume (call_stub_t *stub, int32_t op_ret, int32_t op_errno, server_truncate_cbk (stub->frame, NULL, stub->frame->this, -1, ENOENT, - NULL); + NULL, NULL); server_loc_wipe (&stub->args.truncate.loc); FREE (stub); return 0; @@ -2918,7 +2945,7 @@ server_stub_resume (call_stub_t *stub, int32_t op_ret, int32_t op_errno, server_readlink_cbk (stub->frame, NULL, stub->frame->this, -1, ENOENT, - NULL); + NULL, NULL); server_loc_wipe (&stub->args.readlink.loc); FREE (stub); return 0; @@ -2948,7 +2975,7 @@ server_stub_resume (call_stub_t *stub, int32_t op_ret, int32_t op_errno, server_mkdir_cbk (stub->frame, NULL, stub->frame->this, -1, ENOENT, - NULL, NULL); + NULL, NULL, NULL, NULL); server_loc_wipe (&stub->args.mkdir.loc); FREE (stub); break; @@ -2979,7 +3006,7 @@ server_stub_resume (call_stub_t *stub, int32_t op_ret, int32_t op_errno, server_create_cbk (stub->frame, NULL, stub->frame->this, -1, ENOENT, - NULL, NULL, NULL); + NULL, NULL, NULL, NULL, NULL); if (stub->args.create.fd) fd_unref (stub->args.create.fd); server_loc_wipe (&stub->args.create.loc); @@ -3012,7 +3039,7 @@ server_stub_resume (call_stub_t *stub, int32_t op_ret, int32_t op_errno, server_mknod_cbk (stub->frame, NULL, stub->frame->this, -1, ENOENT, NULL, - NULL); + NULL, NULL, NULL); server_loc_wipe (&stub->args.mknod.loc); FREE (stub); break; @@ -3255,7 +3282,7 @@ server_lookup (call_frame_t *frame, xlator_t *bound_xl, return 0; fail: server_lookup_cbk (frame, NULL, frame->this, -1,EINVAL, NULL, NULL, - NULL); + NULL, NULL); if (xattr_req) dict_unref (xattr_req); @@ -3515,7 +3542,7 @@ server_readlink (call_frame_t *frame, xlator_t *bound_xl, } return 0; fail: - server_readlink_cbk (frame, NULL,frame->this, -1, EINVAL, NULL); + server_readlink_cbk (frame, NULL,frame->this, -1, EINVAL, NULL, NULL); return 0; } @@ -3551,7 +3578,7 @@ server_create_resume (call_frame_t *frame, xlator_t *this, loc_t *loc, return 0; fail: server_create_cbk (frame, NULL, frame->this, -1, EINVAL, NULL, NULL, - NULL); + NULL, NULL, NULL); return 0; } @@ -3606,14 +3633,14 @@ server_create (call_frame_t *frame, xlator_t *bound_xl, return 0; fail: server_create_cbk (frame, NULL, frame->this, -1, EINVAL, NULL, NULL, - NULL); + NULL, NULL, NULL); return 0; } int server_open_resume (call_frame_t *frame, xlator_t *this, loc_t *loc, - int32_t flags, fd_t *fd) + int32_t flags, fd_t *fd, int32_t wbflags) { server_state_t *state = NULL; fd_t *new_fd = NULL; @@ -3633,7 +3660,7 @@ server_open_resume (call_frame_t *frame, xlator_t *this, loc_t *loc, STACK_WIND (frame, server_open_cbk, BOUND_XL(frame), BOUND_XL(frame)->fops->open, - loc, flags, state->fd); + loc, flags, state->fd, wbflags); return 0; fail: @@ -3673,7 +3700,7 @@ server_open (call_frame_t *frame, xlator_t *bound_xl, open_stub = fop_open_stub (frame, server_open_resume, - &(state->loc), state->flags, NULL); + &(state->loc), state->flags, NULL, 0); GF_VALIDATE_OR_GOTO(bound_xl->name, open_stub, fail); if (((state->loc.parent == NULL) && IS_NOT_ROOT(pathlen)) || @@ -3803,7 +3830,7 @@ server_writev (call_frame_t *frame, xlator_t *bound_xl, return 0; fail: - server_writev_cbk (frame, NULL, frame->this, -1, EINVAL, NULL); + server_writev_cbk (frame, NULL, frame->this, -1, EINVAL, NULL, NULL); if (iobref) iobref_unref (iobref); @@ -3892,7 +3919,7 @@ server_fsync (call_frame_t *frame, xlator_t *bound_xl, state->fd, state->flags); return 0; fail: - server_fsync_cbk (frame, NULL, frame->this, -1, EINVAL); + server_fsync_cbk (frame, NULL, frame->this, -1, EINVAL, NULL, NULL); return 0; } @@ -3990,7 +4017,7 @@ server_ftruncate (call_frame_t *frame, xlator_t *bound_xl, state->fd, state->offset); return 0; fail: - server_ftruncate_cbk (frame, NULL, frame->this, -1, EINVAL, NULL); + server_ftruncate_cbk (frame, NULL, frame->this, -1, EINVAL, NULL, NULL); return 0; } diff --git a/xlators/storage/bdb/src/bdb.c b/xlators/storage/bdb/src/bdb.c index bb6d3a43429..daead560418 100644 --- a/xlators/storage/bdb/src/bdb.c +++ b/xlators/storage/bdb/src/bdb.c @@ -374,7 +374,8 @@ bdb_open (call_frame_t *frame, xlator_t *this, loc_t *loc, int32_t flags, - fd_t *fd) + fd_t *fd, + int32_t wbflags) { int32_t op_ret = -1; int32_t op_errno = EINVAL; diff --git a/xlators/storage/posix/src/posix.c b/xlators/storage/posix/src/posix.c index c4f47049c7e..bdfeac1ee64 100644 --- a/xlators/storage/posix/src/posix.c +++ b/xlators/storage/posix/src/posix.c @@ -1822,7 +1822,7 @@ posix_create (call_frame_t *frame, xlator_t *this, int32_t posix_open (call_frame_t *frame, xlator_t *this, - loc_t *loc, int32_t flags, fd_t *fd) + loc_t *loc, int32_t flags, fd_t *fd, int wbflags) { int32_t op_ret = -1; int32_t op_errno = 0; |