ll_have_md_lock() should differentiate between CR and CW OPEN locks.
i=oleg.drokin
i=johann.lombardi
if (de->d_flags & DCACHE_LUSTRE_INVALID)
RETURN(0);
if (de->d_flags & DCACHE_LUSTRE_INVALID)
RETURN(0);
- rc = ll_have_md_lock(parent, MDS_INODELOCK_UPDATE);
+ rc = ll_have_md_lock(parent, MDS_INODELOCK_UPDATE, LCK_MINMODE);
och_usecount = &lli->lli_open_fd_read_count;
}
/* Check for the proper lock. */
och_usecount = &lli->lli_open_fd_read_count;
}
/* Check for the proper lock. */
- if (!ll_have_md_lock(inode, MDS_INODELOCK_LOOKUP))
+ if (!ll_have_md_lock(inode, MDS_INODELOCK_LOOKUP, LCK_MINMODE))
goto do_lock;
cfs_down(&lli->lli_och_sem);
if (*och_p) { /* Everything is open already, do nothing */
goto do_lock;
cfs_down(&lli->lli_och_sem);
if (*och_p) { /* Everything is open already, do nothing */
-int ll_have_md_lock(struct inode *inode, __u64 bits)
+int ll_have_md_lock(struct inode *inode, __u64 bits, ldlm_mode_t l_req_mode)
{
struct lustre_handle lockh;
ldlm_policy_data_t policy = { .l_inodebits = {bits}};
{
struct lustre_handle lockh;
ldlm_policy_data_t policy = { .l_inodebits = {bits}};
+ ldlm_mode_t mode = (l_req_mode == LCK_MINMODE) ?
+ (LCK_CR|LCK_CW|LCK_PR|LCK_PW) : l_req_mode;
struct lu_fid *fid;
int flags;
ENTRY;
struct lu_fid *fid;
int flags;
ENTRY;
RETURN(0);
fid = &ll_i2info(inode)->lli_fid;
RETURN(0);
fid = &ll_i2info(inode)->lli_fid;
- CDEBUG(D_INFO, "trying to match res "DFID"\n", PFID(fid));
+ CDEBUG(D_INFO, "trying to match res "DFID" mode %s\n", PFID(fid),
+ ldlm_lockname[mode]);
flags = LDLM_FL_BLOCK_GRANTED | LDLM_FL_CBPENDING | LDLM_FL_TEST_LOCK;
if (md_lock_match(ll_i2mdexp(inode), flags, fid, LDLM_IBITS, &policy,
flags = LDLM_FL_BLOCK_GRANTED | LDLM_FL_CBPENDING | LDLM_FL_TEST_LOCK;
if (md_lock_match(ll_i2mdexp(inode), flags, fid, LDLM_IBITS, &policy,
- LCK_CR|LCK_CW|LCK_PR|LCK_PW, &lockh)) {
}
ll_lookup_finish_locks(&oit, dentry);
}
ll_lookup_finish_locks(&oit, dentry);
- } else if (!ll_have_md_lock(dentry->d_inode, ibits)) {
+ } else if (!ll_have_md_lock(dentry->d_inode, ibits, LCK_MINMODE)) {
struct ll_sb_info *sbi = ll_i2sbi(dentry->d_inode);
obd_valid valid = OBD_MD_FLGETATTR;
struct md_op_data *op_data;
struct ll_sb_info *sbi = ll_i2sbi(dentry->d_inode);
obd_valid valid = OBD_MD_FLGETATTR;
struct md_op_data *op_data;
!S_ISDIR(ocapa->u.cli.inode->i_mode) &&
obd_capa_open_count(ocapa) == 0 &&
!ll_have_md_lock(ocapa->u.cli.inode,
!S_ISDIR(ocapa->u.cli.inode->i_mode) &&
obd_capa_open_count(ocapa) == 0 &&
!ll_have_md_lock(ocapa->u.cli.inode,
- MDS_INODELOCK_LOOKUP)) {
+ MDS_INODELOCK_LOOKUP,
+ LCK_MINMODE)) {
DEBUG_CAPA(D_SEC, &ocapa->c_capa,
"skip renewal for");
sort_add_capa(ocapa, &ll_idle_capas);
DEBUG_CAPA(D_SEC, &ocapa->c_capa,
"skip renewal for");
sort_add_capa(ocapa, &ll_idle_capas);
extern struct file_operations ll_file_operations_noflock;
extern struct inode_operations ll_file_inode_operations;
extern int ll_inode_revalidate_it(struct dentry *, struct lookup_intent *);
extern struct file_operations ll_file_operations_noflock;
extern struct inode_operations ll_file_inode_operations;
extern int ll_inode_revalidate_it(struct dentry *, struct lookup_intent *);
-extern int ll_have_md_lock(struct inode *inode, __u64 bits);
+extern int ll_have_md_lock(struct inode *inode, __u64 bits, ldlm_mode_t l_req_mode);
extern ldlm_mode_t ll_take_md_lock(struct inode *inode, __u64 bits,
struct lustre_handle *lockh);
int __ll_inode_revalidate_it(struct dentry *, struct lookup_intent *, __u64 bits);
extern ldlm_mode_t ll_take_md_lock(struct inode *inode, __u64 bits,
struct lustre_handle *lockh);
int __ll_inode_revalidate_it(struct dentry *, struct lookup_intent *, __u64 bits);
struct ll_inode_info *lli;
__u64 bits = lock->l_policy_data.l_inodebits.bits;
struct lu_fid *fid;
struct ll_inode_info *lli;
__u64 bits = lock->l_policy_data.l_inodebits.bits;
struct lu_fid *fid;
+ ldlm_mode_t mode = lock->l_req_mode;
/* Invalidate all dentries associated with this inode */
if (inode == NULL)
break;
LASSERT(lock->l_flags & LDLM_FL_CANCELING);
/* Invalidate all dentries associated with this inode */
if (inode == NULL)
break;
LASSERT(lock->l_flags & LDLM_FL_CANCELING);
+ /* For OPEN locks we differentiate between lock modes - CR, CW. PR - bug 22891 */
if ((bits & MDS_INODELOCK_LOOKUP) &&
if ((bits & MDS_INODELOCK_LOOKUP) &&
- ll_have_md_lock(inode, MDS_INODELOCK_LOOKUP))
+ ll_have_md_lock(inode, MDS_INODELOCK_LOOKUP, LCK_MINMODE))
bits &= ~MDS_INODELOCK_LOOKUP;
if ((bits & MDS_INODELOCK_UPDATE) &&
bits &= ~MDS_INODELOCK_LOOKUP;
if ((bits & MDS_INODELOCK_UPDATE) &&
- ll_have_md_lock(inode, MDS_INODELOCK_UPDATE))
+ ll_have_md_lock(inode, MDS_INODELOCK_UPDATE, LCK_MINMODE))
bits &= ~MDS_INODELOCK_UPDATE;
if ((bits & MDS_INODELOCK_OPEN) &&
bits &= ~MDS_INODELOCK_UPDATE;
if ((bits & MDS_INODELOCK_OPEN) &&
- ll_have_md_lock(inode, MDS_INODELOCK_OPEN))
+ ll_have_md_lock(inode, MDS_INODELOCK_OPEN, mode))
bits &= ~MDS_INODELOCK_OPEN;
fid = ll_inode2fid(inode);
bits &= ~MDS_INODELOCK_OPEN;
fid = ll_inode2fid(inode);
/* Check that parent has UPDATE lock. If there is none, we
cannot afford to hash this dentry (done by ll_d_add) as it
might get picked up later when UPDATE lock will appear */
/* Check that parent has UPDATE lock. If there is none, we
cannot afford to hash this dentry (done by ll_d_add) as it
might get picked up later when UPDATE lock will appear */
- if (ll_have_md_lock(parent, MDS_INODELOCK_UPDATE)) {
+ if (ll_have_md_lock(parent, MDS_INODELOCK_UPDATE, LCK_MINMODE)) {
spin_lock(&dcache_lock);
ll_d_add(*de, NULL);
spin_unlock(&dcache_lock);
spin_lock(&dcache_lock);
ll_d_add(*de, NULL);
spin_unlock(&dcache_lock);