lsm_md_dump(D_ERROR, lsm);
GOTO(unlock, rc = -EINVAL);
}
-
+
up_read(&lli->lli_lsm_sem);
down_write(&lli->lli_lsm_sem);
/* clear existing lsm */
up_write(&lli->lli_lsm_sem);
if (rc)
RETURN(rc);
-
+
/* set md->lmv to NULL, so the following free lustre_md will not free
* this lsm.
*/
OBD_ALLOC_PTR(attr);
if (!attr)
GOTO(unlock, rc = -ENOMEM);
-
+
/* validate the lsm */
rc = md_merge_attr(ll_i2mdexp(inode), lli->lli_lsm_md, attr,
ll_md_blocking_ast);
return 0;
}
+void ll_truncate_inode_pages_final(struct inode *inode)
+{
+ struct address_space *mapping = &inode->i_data;
+ unsigned long nrpages;
+ unsigned long flags;
+
+ truncate_inode_pages_final(mapping);
+
+ /* Workaround for LU-118: Note nrpages may not be totally updated when
+ * truncate_inode_pages() returns, as there can be a page in the process
+ * of deletion (inside __delete_from_page_cache()) in the specified
+ * range. Thus mapping->nrpages can be non-zero when this function
+ * returns even after truncation of the whole mapping. Only do this if
+ * npages isn't already zero.
+ */
+ nrpages = mapping->nrpages;
+ if (nrpages) {
+ xa_lock_irqsave(&mapping->i_pages, flags);
+ nrpages = mapping->nrpages;
+ xa_unlock_irqrestore(&mapping->i_pages, flags);
+ } /* Workaround end */
+
+ LASSERTF(nrpages == 0, "%s: inode="DFID"(%p) nrpages=%lu, "
+ "see https://jira.whamcloud.com/browse/LU-118\n",
+ ll_get_fsname(inode->i_sb, NULL, 0),
+ PFID(ll_inode2fid(inode)), inode, nrpages);
+}
+
int ll_read_inode2(struct inode *inode, void *opaque)
{
struct lustre_md *md = opaque;
void ll_delete_inode(struct inode *inode)
{
struct ll_inode_info *lli = ll_i2info(inode);
- struct address_space *mapping = &inode->i_data;
- unsigned long nrpages;
ENTRY;
if (S_ISREG(inode->i_mode) && lli->lli_clob != NULL) {
cl_sync_file_range(inode, 0, OBD_OBJECT_EOF, inode->i_nlink ?
CL_FSYNC_LOCAL : CL_FSYNC_DISCARD, 1);
}
- truncate_inode_pages_final(mapping);
- /* Workaround for LU-118: Note nrpages may not be totally updated when
- * truncate_inode_pages() returns, as there can be a page in the process
- * of deletion (inside __delete_from_page_cache()) in the specified
- * range. Thus mapping->nrpages can be non-zero when this function
- * returns even after truncation of the whole mapping. Only do this if
- * npages isn't already zero.
- */
- nrpages = mapping->nrpages;
- if (nrpages) {
- xa_lock_irq(&mapping->i_pages);
- nrpages = mapping->nrpages;
- xa_unlock_irq(&mapping->i_pages);
- } /* Workaround end */
-
- LASSERTF(nrpages == 0, "%s: inode="DFID"(%p) nrpages=%lu, "
- "see https://jira.whamcloud.com/browse/LU-118\n",
- ll_get_fsname(inode->i_sb, NULL, 0),
- PFID(ll_inode2fid(inode)), inode, nrpages);
+ ll_truncate_inode_pages_final(inode);
#ifdef HAVE_SBOPS_EVICT_INODE
ll_clear_inode(inode);