#include <linux/fs.h>
/* XATTR_{REPLACE,CREATE} */
#include <linux/xattr.h>
-/* simple_mkdir() */
-#include <lvfs.h>
/*
* struct OBD_{ALLOC,FREE}*()
static int osd_ro(const struct lu_env *env, struct dt_device *d)
{
- struct super_block *sb = osd_sb(osd_dt_dev(d));
- int rc;
- ENTRY;
+ struct super_block *sb = osd_sb(osd_dt_dev(d));
+ struct block_device *dev = sb->s_bdev;
+#ifdef HAVE_DEV_SET_RDONLY
+ struct block_device *jdev = LDISKFS_SB(sb)->journal_bdev;
+ int rc = 0;
+#else
+ int rc = -EOPNOTSUPP;
+#endif
+ ENTRY;
+#ifdef HAVE_DEV_SET_RDONLY
CERROR("*** setting %s read-only ***\n", osd_dt_dev(d)->od_svname);
- rc = __lvfs_set_rdonly(sb->s_bdev, LDISKFS_SB(sb)->journal_bdev);
- RETURN(rc);
+ if (jdev && (jdev != dev)) {
+ CDEBUG(D_IOCTL | D_HA, "set journal dev %lx rdonly\n",
+ (long)jdev);
+ dev_set_rdonly(jdev);
+ }
+ CDEBUG(D_IOCTL | D_HA, "set dev %lx rdonly\n", (long)dev);
+ dev_set_rdonly(dev);
+#else
+ CERROR("%s: %lx CANNOT BE SET READONLY: rc = %d\n",
+ osd_dt_dev(d)->od_svname, (long)dev, rc);
+#endif
+ RETURN(rc);
}
/*
spin_unlock(&obj->oo_guard);
if (!rc)
- inode->i_sb->s_op->dirty_inode(inode);
+ ll_dirty_inode(inode, I_DIRTY_DATASYNC);
return rc;
}
* enabled on ldiskfs (lquota takes care of it).
*/
LASSERTF(result == 0, "%d", result);
- inode->i_sb->s_op->dirty_inode(inode);
+ ll_dirty_inode(inode, I_DIRTY_DATASYNC);
}
attr->la_valid = valid;
struct thandle *th)
{
int result;
+ __u32 umask;
+
+ /* we drop umask so that permissions we pass are not affected */
+ umask = current->fs->umask;
+ current->fs->umask = 0;
result = osd_create_type_f(dof->dof_type)(info, obj, attr, hint, dof,
th);
unlock_new_inode(obj->oo_inode);
}
- return result;
+ /* restore previous umask value */
+ current->fs->umask = umask;
+
+ return result;
}
/**
spin_lock(&obj->oo_guard);
clear_nlink(inode);
spin_unlock(&obj->oo_guard);
- inode->i_sb->s_op->dirty_inode(inode);
+ ll_dirty_inode(inode, I_DIRTY_DATASYNC);
}
osd_trans_exec_op(env, th, OSD_OT_DESTROY);
}
LASSERT(inode->i_nlink <= LDISKFS_LINK_MAX);
spin_unlock(&obj->oo_guard);
- inode->i_sb->s_op->dirty_inode(inode);
+ ll_dirty_inode(inode, I_DIRTY_DATASYNC);
LINVRNT(osd_invariant(obj));
return 0;
if (S_ISDIR(inode->i_mode) && inode->i_nlink == 0)
set_nlink(inode, 1);
spin_unlock(&obj->oo_guard);
- inode->i_sb->s_op->dirty_inode(inode);
+ ll_dirty_inode(inode, I_DIRTY_DATASYNC);
LINVRNT(osd_invariant(obj));
return 0;
LDISKFS_I(inode)->i_fs_version = *new_version;
/** Version is set after all inode operations are finished,
* so we should mark it dirty here */
- inode->i_sb->s_op->dirty_inode(inode);
+ ll_dirty_inode(inode, I_DIRTY_DATASYNC);
}
/*
struct inode *inode = obj->oo_inode;
struct osd_thread_info *info = osd_oti_get(env);
int fs_flags = 0;
+ ENTRY;
LASSERT(handle != NULL);
file->f_dentry = dentry;
file->f_mapping = inode->i_mapping;
file->f_op = inode->i_fop;
+#ifndef HAVE_FILE_FSYNC_4ARGS
mutex_lock(&inode->i_mutex);
- rc = file->f_op->fsync(file, dentry, 0);
+#endif
+ rc = do_fsync(file, 0);
+#ifndef HAVE_FILE_FSYNC_4ARGS
mutex_unlock(&inode->i_mutex);
+#endif
RETURN(rc);
}
{
/* check if file type is required */
if (ent->lde_attrs & LUDA_TYPE) {
- int align = sizeof(struct luda_type) - 1;
struct luda_type *lt;
+ int align = sizeof(*lt) - 1;
len = (len + align) & ~align;
lt = (struct luda_type *)(ent->lde_name + len);
- lt->lt_type = cpu_to_le16(CFS_DTTOIF(type));
+ lt->lt_type = cpu_to_le16(DTTOIF(type));
}
ent->lde_attrs = cpu_to_le32(ent->lde_attrs);
static void osd_key_fini(const struct lu_context *ctx,
struct lu_context_key *key, void* data)
{
- struct osd_thread_info *info = data;
+ struct osd_thread_info *info = data;
- if (info->oti_hlock != NULL)
- ldiskfs_htree_lock_free(info->oti_hlock);
- OBD_FREE(info->oti_it_ea_buf, OSD_IT_EA_BUFSIZE);
- OBD_FREE_PTR(info);
+ if (info->oti_hlock != NULL)
+ ldiskfs_htree_lock_free(info->oti_hlock);
+ OBD_FREE(info->oti_it_ea_buf, OSD_IT_EA_BUFSIZE);
+ lu_buf_free(&info->oti_iobuf.dr_pg_buf);
+ lu_buf_free(&info->oti_iobuf.dr_bl_buf);
+ OBD_FREE_PTR(info);
}
static void osd_key_exit(const struct lu_context *ctx,
GOTO(out, rc);
}
- if (lvfs_check_rdonly(o->od_mnt->mnt_sb->s_bdev)) {
+#ifdef HAVE_DEV_SET_RDONLY
+ if (dev_check_rdonly(o->od_mnt->mnt_sb->s_bdev)) {
CERROR("%s: underlying device %s is marked as read-only. "
"Setup failed\n", name, dev);
mntput(o->od_mnt);
o->od_mnt = NULL;
GOTO(out, rc = -EROFS);
}
+#endif
if (!LDISKFS_HAS_COMPAT_FEATURE(o->od_mnt->mnt_sb,
LDISKFS_FEATURE_COMPAT_HAS_JOURNAL)) {