extern struct inode_operations ll_special_inode_operations;
extern int ll_inode_revalidate_it(struct dentry *, struct lookup_intent *);
int ll_extent_lock(struct ll_file_data *, struct inode *,
- struct lov_stripe_md *, int mode, struct ldlm_extent *,
- struct lustre_handle *);
+ struct lov_stripe_md *, int mode, ldlm_policy_data_t *,
+ struct lustre_handle *, int ast_flags);
int ll_extent_unlock(struct ll_file_data *, struct inode *,
struct lov_stripe_md *, int mode, struct lustre_handle *);
int ll_file_open(struct inode *inode, struct file *file);
int ll_file_release(struct inode *inode, struct file *file);
int ll_lsm_getattr(struct obd_export *, struct lov_stripe_md *, struct obdo *);
-int ll_extent_lock_no_validate(struct ll_file_data *, struct inode *,
- struct lov_stripe_md *, int mode,
- struct ldlm_extent *, struct lustre_handle *,
- int ast_flags);
+int ll_glimpse_size(struct inode *inode, struct ost_lvb *lvb);
#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0))
int ll_getattr(struct vfsmount *mnt, struct dentry *de,
struct lookup_intent *it, struct kstat *stat);
ENTRY;
CDEBUG(D_VFSTRACE, "VFS Op: sb %p\n", sb);
+ if (lmd == NULL) {
+ CERROR("lustre_mount_data is NULL: check that /sbin/mount.lustre exists?\n");
+ RETURN(-EINVAL);
+ }
sbi = lustre_init_sbi(sb);
if (!sbi)
RETURN(-ENOMEM);
* last one is especially bad for racing o_append users on other
* nodes. */
if (ia_valid & ATTR_SIZE) {
- struct ldlm_extent extent = { .start = attr->ia_size,
- .end = OBD_OBJECT_EOF };
+ ldlm_policy_data_t policy = { .l_extent = {attr->ia_size,
+ OBD_OBJECT_EOF } };
struct lustre_handle lockh = { 0 };
int err, ast_flags = 0;
/* XXX when we fix the AST intents to pass the discard-range
/* bug 1639: avoid write/truncate i_sem/DLM deadlock */
LASSERT(atomic_read(&inode->i_sem.count) <= 0);
up(&inode->i_sem);
- rc = ll_extent_lock_no_validate(NULL, inode, lsm, LCK_PW,
- &extent, &lockh, ast_flags);
+ rc = ll_extent_lock(NULL, inode, lsm, LCK_PW, &policy, &lockh,
+ ast_flags);
down(&inode->i_sem);
if (rc != ELDLM_OK)
RETURN(rc);
rc = vmtruncate(inode, attr->ia_size);
- if (rc == 0)
- set_bit(LLI_F_HAVE_OST_SIZE_LOCK,
- &ll_i2info(inode)->lli_flags);
-
- //ll_try_done_writing(inode);
+ /* We need to drop the semaphore here, because this unlock may
+ * result in a cancellation, which will need the i_sem */
+ up(&inode->i_sem);
/* unlock now as we don't mind others file lockers racing with
* the mds updates below? */
err = ll_extent_unlock(NULL, inode, lsm, LCK_PW, &lockh);
+ down(&inode->i_sem);
if (err) {
CERROR("ll_extent_unlock failed: %d\n", err);
if (!rc)