|
@@ -1364,8 +1364,10 @@ static int ll_setattr_ost(struct inode *inode, struct iattr *attr)
|
|
* to the OST with the punch RPC, otherwise we do an explicit setattr RPC.
|
|
* to the OST with the punch RPC, otherwise we do an explicit setattr RPC.
|
|
* I don't believe it is possible to get e.g. ATTR_MTIME_SET and ATTR_SIZE
|
|
* I don't believe it is possible to get e.g. ATTR_MTIME_SET and ATTR_SIZE
|
|
* at the same time.
|
|
* at the same time.
|
|
|
|
+ *
|
|
|
|
+ * In case of HSMimport, we only set attr on MDS.
|
|
*/
|
|
*/
|
|
-int ll_setattr_raw(struct dentry *dentry, struct iattr *attr)
|
|
|
|
|
|
+int ll_setattr_raw(struct dentry *dentry, struct iattr *attr, bool hsm_import)
|
|
{
|
|
{
|
|
struct inode *inode = dentry->d_inode;
|
|
struct inode *inode = dentry->d_inode;
|
|
struct ll_inode_info *lli = ll_i2info(inode);
|
|
struct ll_inode_info *lli = ll_i2info(inode);
|
|
@@ -1374,10 +1376,12 @@ int ll_setattr_raw(struct dentry *dentry, struct iattr *attr)
|
|
bool file_is_released = false;
|
|
bool file_is_released = false;
|
|
int rc = 0, rc1 = 0;
|
|
int rc = 0, rc1 = 0;
|
|
|
|
|
|
- CDEBUG(D_VFSTRACE, "%s: setattr inode %p/fid:"DFID" from %llu to %llu, "
|
|
|
|
- "valid %x\n", ll_get_fsname(inode->i_sb, NULL, 0), inode,
|
|
|
|
|
|
+ CDEBUG(D_VFSTRACE,
|
|
|
|
+ "%s: setattr inode %p/fid:"DFID
|
|
|
|
+ " from %llu to %llu, valid %x, hsm_import %d\n",
|
|
|
|
+ ll_get_fsname(inode->i_sb, NULL, 0), inode,
|
|
PFID(&lli->lli_fid), i_size_read(inode), attr->ia_size,
|
|
PFID(&lli->lli_fid), i_size_read(inode), attr->ia_size,
|
|
- attr->ia_valid);
|
|
|
|
|
|
+ attr->ia_valid, hsm_import);
|
|
|
|
|
|
if (attr->ia_valid & ATTR_SIZE) {
|
|
if (attr->ia_valid & ATTR_SIZE) {
|
|
/* Check new size against VFS/VM file size limit and rlimit */
|
|
/* Check new size against VFS/VM file size limit and rlimit */
|
|
@@ -1470,20 +1474,20 @@ int ll_setattr_raw(struct dentry *dentry, struct iattr *attr)
|
|
ccc_inode_lsm_put(inode, lsm);
|
|
ccc_inode_lsm_put(inode, lsm);
|
|
}
|
|
}
|
|
|
|
|
|
- /* clear size attr for released file
|
|
|
|
|
|
+ /* if not in HSM import mode, clear size attr for released file
|
|
* we clear the attribute send to MDT in op_data, not the original
|
|
* we clear the attribute send to MDT in op_data, not the original
|
|
* received from caller in attr which is used later to
|
|
* received from caller in attr which is used later to
|
|
* decide return code */
|
|
* decide return code */
|
|
- if (file_is_released && (attr->ia_valid & ATTR_SIZE))
|
|
|
|
|
|
+ if (file_is_released && (attr->ia_valid & ATTR_SIZE) && !hsm_import)
|
|
op_data->op_attr.ia_valid &= ~ATTR_SIZE;
|
|
op_data->op_attr.ia_valid &= ~ATTR_SIZE;
|
|
|
|
|
|
rc = ll_md_setattr(dentry, op_data, &mod);
|
|
rc = ll_md_setattr(dentry, op_data, &mod);
|
|
if (rc)
|
|
if (rc)
|
|
GOTO(out, rc);
|
|
GOTO(out, rc);
|
|
|
|
|
|
- /* truncate failed, others succeed */
|
|
|
|
|
|
+ /* truncate failed (only when non HSM import), others succeed */
|
|
if (file_is_released) {
|
|
if (file_is_released) {
|
|
- if (attr->ia_valid & ATTR_SIZE)
|
|
|
|
|
|
+ if ((attr->ia_valid & ATTR_SIZE) && !hsm_import)
|
|
GOTO(out, rc = -ENODATA);
|
|
GOTO(out, rc = -ENODATA);
|
|
else
|
|
else
|
|
GOTO(out, rc = 0);
|
|
GOTO(out, rc = 0);
|
|
@@ -1522,7 +1526,7 @@ out:
|
|
if (!S_ISDIR(inode->i_mode)) {
|
|
if (!S_ISDIR(inode->i_mode)) {
|
|
up_write(&lli->lli_trunc_sem);
|
|
up_write(&lli->lli_trunc_sem);
|
|
mutex_lock(&inode->i_mutex);
|
|
mutex_lock(&inode->i_mutex);
|
|
- if (attr->ia_valid & ATTR_SIZE)
|
|
|
|
|
|
+ if ((attr->ia_valid & ATTR_SIZE) && !hsm_import)
|
|
inode_dio_wait(inode);
|
|
inode_dio_wait(inode);
|
|
}
|
|
}
|
|
|
|
|
|
@@ -1557,7 +1561,7 @@ int ll_setattr(struct dentry *de, struct iattr *attr)
|
|
!(attr->ia_valid & ATTR_KILL_SGID))
|
|
!(attr->ia_valid & ATTR_KILL_SGID))
|
|
attr->ia_valid |= ATTR_KILL_SGID;
|
|
attr->ia_valid |= ATTR_KILL_SGID;
|
|
|
|
|
|
- return ll_setattr_raw(de, attr);
|
|
|
|
|
|
+ return ll_setattr_raw(de, attr, false);
|
|
}
|
|
}
|
|
|
|
|
|
int ll_statfs_internal(struct super_block *sb, struct obd_statfs *osfs,
|
|
int ll_statfs_internal(struct super_block *sb, struct obd_statfs *osfs,
|