Commit 6fe5042c authored by Dean Roehrich's avatar Dean Roehrich Committed by Stephen Lord

[XFS] fix dmapi POSTCREATE event in xfs_create/xfs_mkdir

SGI Modid: 2.5.x-xfs:slinx:140501a
parent 2e8dcc3b
...@@ -1920,6 +1920,7 @@ xfs_create( ...@@ -1920,6 +1920,7 @@ xfs_create(
xfs_bmap_free_t free_list; xfs_bmap_free_t free_list;
xfs_fsblock_t first_block; xfs_fsblock_t first_block;
boolean_t dp_joined_to_trans; boolean_t dp_joined_to_trans;
int dm_event_sent = 0;
uint cancel_flags; uint cancel_flags;
int committed; int committed;
xfs_prid_t prid; xfs_prid_t prid;
...@@ -1944,15 +1945,16 @@ xfs_create( ...@@ -1944,15 +1945,16 @@ xfs_create(
dm_di_mode, 0, 0); dm_di_mode, 0, 0);
if (error) if (error)
return error; return error;
dm_event_sent = 1;
} }
/* Return through std_return after this point. */
mp = dp->i_mount; mp = dp->i_mount;
if (XFS_FORCED_SHUTDOWN(mp)) if (XFS_FORCED_SHUTDOWN(mp))
return XFS_ERROR(EIO); return XFS_ERROR(EIO);
/* Return through std_return after this point. */
udqp = gdqp = NULL; udqp = gdqp = NULL;
if (vap->va_mask & XFS_AT_PROJID) if (vap->va_mask & XFS_AT_PROJID)
prid = (xfs_prid_t)vap->va_projid; prid = (xfs_prid_t)vap->va_projid;
...@@ -2112,12 +2114,12 @@ xfs_create( ...@@ -2112,12 +2114,12 @@ xfs_create(
/* Fallthrough to std_return with error = 0 */ /* Fallthrough to std_return with error = 0 */
std_return: std_return:
if ((error != 0) && if ( (*vpp || (error != 0 && dm_event_sent != 0)) &&
DM_EVENT_ENABLED(dir_vp->v_vfsp, XFS_BHVTOI(dir_bdp), DM_EVENT_ENABLED(dir_vp->v_vfsp, XFS_BHVTOI(dir_bdp),
DM_EVENT_POSTCREATE)) { DM_EVENT_POSTCREATE)) {
(void) dm_send_namesp_event(DM_EVENT_POSTCREATE, (void) dm_send_namesp_event(DM_EVENT_POSTCREATE,
dir_bdp, DM_RIGHT_NULL, dir_bdp, DM_RIGHT_NULL,
vn_bhv_lookup_unlocked(VN_BHV_HEAD(vp), &xfs_vnodeops), *vpp ? vn_bhv_lookup_unlocked(VN_BHV_HEAD(vp), &xfs_vnodeops):NULL,
DM_RIGHT_NULL, name, NULL, DM_RIGHT_NULL, name, NULL,
dm_di_mode, error, 0); dm_di_mode, error, 0);
} }
...@@ -2839,6 +2841,7 @@ xfs_mkdir( ...@@ -2839,6 +2841,7 @@ xfs_mkdir(
vnode_t *dir_vp; vnode_t *dir_vp;
boolean_t dp_joined_to_trans; boolean_t dp_joined_to_trans;
boolean_t created = B_FALSE; boolean_t created = B_FALSE;
int dm_event_sent = 0;
xfs_prid_t prid; xfs_prid_t prid;
xfs_dquot_t *udqp, *gdqp; xfs_dquot_t *udqp, *gdqp;
uint resblks; uint resblks;
...@@ -2865,6 +2868,7 @@ xfs_mkdir( ...@@ -2865,6 +2868,7 @@ xfs_mkdir(
dm_di_mode, 0, 0); dm_di_mode, 0, 0);
if (error) if (error)
return error; return error;
dm_event_sent = 1;
} }
/* Return through std_return after this point. */ /* Return through std_return after this point. */
...@@ -3027,7 +3031,7 @@ xfs_mkdir( ...@@ -3027,7 +3031,7 @@ xfs_mkdir(
* xfs_trans_commit. */ * xfs_trans_commit. */
std_return: std_return:
if ( (created || (error != 0)) && if ( (created || (error != 0 && dm_event_sent != 0)) &&
DM_EVENT_ENABLED(dir_vp->v_vfsp, XFS_BHVTOI(dir_bdp), DM_EVENT_ENABLED(dir_vp->v_vfsp, XFS_BHVTOI(dir_bdp),
DM_EVENT_POSTCREATE)) { DM_EVENT_POSTCREATE)) {
(void) dm_send_namesp_event(DM_EVENT_POSTCREATE, (void) dm_send_namesp_event(DM_EVENT_POSTCREATE,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment