@@ -196,8 +196,12 @@ void mdc_create_pack(struct ptlrpc_request *req, struct md_op_data *op_data,
static inline u64 mds_pack_open_flags(u64 flags)
{
- u64 cr_flags = (flags & (FMODE_READ | FMODE_WRITE |
- MDS_OPEN_FL_INTERNAL));
+ u64 cr_flags = (flags & MDS_OPEN_FL_INTERNAL);
+
+ if (flags & FMODE_READ)
+ cr_flags |= MDS_FMODE_READ;
+ if (flags & FMODE_WRITE)
+ cr_flags |= MDS_FMODE_WRITE;
if (flags & O_CREAT)
cr_flags |= MDS_OPEN_CREAT;
if (flags & O_EXCL)
@@ -263,12 +263,12 @@ static int mdc_save_lovea(struct ptlrpc_request *req,
/* If inode is known, cancel conflicting OPEN locks. */
if (fid_is_sane(&op_data->op_fid2)) {
if (it->it_flags & MDS_OPEN_LEASE) { /* try to get lease */
- if (it->it_flags & FMODE_WRITE)
+ if (it->it_flags & MDS_FMODE_WRITE)
mode = LCK_EX;
else
mode = LCK_PR;
} else {
- if (it->it_flags & (FMODE_WRITE | MDS_OPEN_TRUNC))
+ if (it->it_flags & (MDS_FMODE_WRITE | MDS_OPEN_TRUNC))
mode = LCK_CW;
else if (it->it_flags & __FMODE_EXEC)
mode = LCK_PR;
@@ -1540,7 +1540,7 @@ static inline bool obd_skip_mod_rpc_slot(const struct lookup_intent *it)
if (it &&
(it->it_op == IT_GETATTR || it->it_op == IT_LOOKUP ||
it->it_op == IT_READDIR ||
- (it->it_op == IT_LAYOUT && !(it->it_flags & FMODE_WRITE))))
+ (it->it_op == IT_LAYOUT && !(it->it_flags & MDS_FMODE_WRITE))))
return true;
return false;
}
@@ -866,6 +866,9 @@ enum la_valid {
LA_REMOTE_ATTR_SET = (LA_UID | LA_GID | LA_PROJID | LA_LAYOUT_VERSION)
};
+#define MDS_FMODE_READ 00000001
+#define MDS_FMODE_WRITE 00000002
+
#define MDS_FMODE_CLOSED 00000000
#define MDS_FMODE_EXEC 00000004
/* MDS_FMODE_EPOCH 01000000 obsolete since 2.8.0 */