Beispiel #1
0
/* Add metafile to datafile's attributes */
static PINT_sm_action set_new_datafile_attribs_op(struct PINT_smcb *smcb, job_status_s *js_p)
{

  int ret;
  struct PINT_server_op *s_op = PINT_sm_frame(smcb, PINT_FRAME_CURRENT);
  job_id_t j_id;

 
  set_df_attr.metafile = s_op->req->u.migposter.metafile;

  ret = job_trove_dspace_setattr(
				 s_op->req->u.migposter.fs_id,
				 new_handle,
				 &set_df_attr, 
				 TROVE_SYNC,
				 smcb, 
				 0, 
				 js_p, 
				 &j_id, 
				 server_job_context, 
				 NULL);
  
  return ret;  
  
}
Beispiel #2
0
static PINT_sm_action chdirent_update_directory_attr(
        struct PINT_smcb *smcb, job_status_s *js_p)
{
    struct PINT_server_op *s_op = PINT_sm_frame(smcb, PINT_FRAME_CURRENT);
    int ret = -1;
    job_id_t j_id;
    PVFS_object_attr tmp_attr, *tmp_attr_ptr = &tmp_attr;
    PVFS_object_attr *dspace_attr = NULL;
    PVFS_ds_attributes *ds_attr = NULL;

    if (js_p->error_code != UPDATE_DIR_ATTR_REQUIRED)
    {
        PVFS_perror_gossip("previous keyval write failed",
                           js_p->error_code);
        return SM_ACTION_COMPLETE;
    }

    memset(&tmp_attr, 0, sizeof(PVFS_object_attr));
    dspace_attr = &s_op->attr;
    dspace_attr->mask |= (PVFS_ATTR_COMMON_ATIME | PVFS_ATTR_COMMON_MTIME | PVFS_ATTR_COMMON_CTIME);

    PVFS_object_attr_overwrite_setable(tmp_attr_ptr, dspace_attr);
    ds_attr = &(s_op->ds_attr);
    PVFS_object_attr_to_ds_attr(tmp_attr_ptr, ds_attr);

    ret = job_trove_dspace_setattr(
        s_op->req->u.chdirent.fs_id, s_op->req->u.chdirent.handle,
        ds_attr, 
        TROVE_SYNC |
        0,
        smcb, 0, js_p, &j_id, server_job_context, s_op->req->hints);

    return ret;
}
Beispiel #3
0
static PINT_sm_action setattr_setobj_attribs(
        struct PINT_smcb *smcb, job_status_s *js_p)
{
    struct PINT_server_op *s_op = PINT_sm_frame(smcb, PINT_FRAME_CURRENT);
    int ret = -1;
    job_id_t j_id;
    PVFS_object_attr *a_p = NULL;
    PVFS_object_attr *dspace_a_p = NULL;
    PVFS_ds_attributes *ds_attr = NULL;

    dspace_a_p = &s_op->attr;
    a_p = &s_op->req->u.setattr.attr;

    if (a_p->mask & PVFS_ATTR_META_DFILES)
    {
        gossip_debug(GOSSIP_SETATTR_DEBUG, " request has dfile_count of "
                     "%d | dspace has %d\n",
                     s_op->req->u.setattr.attr.u.meta.dfile_count,
                     s_op->attr.u.meta.dfile_count);

        gossip_debug(GOSSIP_SETATTR_DEBUG, " writing count of %d to "
                     "disk\n", dspace_a_p->u.meta.dfile_count);
    }
    /* 
     * Remember that mtime is versioned on disk! so convert it here..
     * It is better to do it here than change the PVFS_object_attr_overwrite_setable
     * macro, since there are many more users of it, I think.
     */
     if (a_p->mask & PVFS_ATTR_COMMON_MTIME_SET)
     {
         PVFS_time orig_mtime = a_p->mtime;
         a_p->mtime = PINT_util_mktime_version(orig_mtime);
         gossip_debug(GOSSIP_SETATTR_DEBUG, "setting version "
                 "to %llu\n\tmtime is %llu\n",
                 llu(a_p->mtime), llu(orig_mtime));
     }

    /* if the object is a symbolic link, check to make sure that the request
     * is not attempting to change the permissions 
     */
    if(dspace_a_p->objtype == PVFS_TYPE_SYMLINK)
    {
        if (dspace_a_p->perms != 0 && ((a_p->mask & PVFS_ATTR_COMMON_PERM) && (dspace_a_p->perms != a_p->perms)))
        {
            gossip_debug(GOSSIP_SETATTR_DEBUG, "Cannot change perms of symlink: Permission denied\n");
            js_p->error_code = -PVFS_EPERM;
            return SM_ACTION_COMPLETE;
        }
    }

    /*
      we have the attribs stored in the dspace, as well as the
      requested attribs to store.  overwrite the ones that are setable
      and specified by the mask value in the request; macro defined in
      pvfs2-storage.h
    */
    PVFS_object_attr_overwrite_setable(dspace_a_p, a_p);

    gossip_debug(
        GOSSIP_SETATTR_DEBUG,
        "  WRITING attrs: [owner = %d, group = %d\n\t"
        "perms = %o, type = %d, atime = %llu, mtime = %llu\n\t"
        "ctime = %llu | dfile_count = %d | dist_size = %d\n\t"
        "handle = %llu | S = %p | mask = %d]\n",
        dspace_a_p->owner, dspace_a_p->group, dspace_a_p->perms,
        dspace_a_p->objtype, llu(dspace_a_p->atime),
        llu(PINT_util_mkversion_time(dspace_a_p->mtime)), llu(dspace_a_p->ctime),
        (int)dspace_a_p->u.meta.dfile_count,
        (int)dspace_a_p->u.meta.dist_size,
        llu(s_op->req->u.setattr.handle), s_op, a_p->mask);

    /* translate attrs to storage attr format */
    ds_attr = &(s_op->ds_attr);
    PVFS_object_attr_to_ds_attr(dspace_a_p, ds_attr);

    ret = job_trove_dspace_setattr(
        s_op->req->u.setattr.fs_id, s_op->req->u.setattr.handle,
        ds_attr, 
        TROVE_SYNC,
        smcb, 0, js_p, &j_id, server_job_context, s_op->req->hints);

    return ret;
}