@@ -517,7 +517,7 @@
/* FLR */
#define OBD_FAIL_FLR_LV_DELAY 0x1A01
-#define OBD_FAIL_FLR_LV_INC 0x1A02
+#define OBD_FAIL_FLR_LV_INC 0x1A02 /* unused since 2.15 */
#define OBD_FAIL_FLR_RANDOM_PICK_MIRROR 0x1A03
/* LNet is allocated failure locations 0xe000 to 0xffff */
@@ -3553,6 +3553,7 @@ static long ll_file_unlock_lease(struct file *file, struct ll_ioc_lease *ioc,
bool lease_broken = false;
fmode_t fmode = 0;
enum mds_op_bias bias = 0;
+ int fdv;
struct file *layout_file = NULL;
void *data = NULL;
size_t data_size = 0;
@@ -3592,21 +3593,19 @@ static long ll_file_unlock_lease(struct file *file, struct ll_ioc_lease *ioc,
bias = MDS_CLOSE_RESYNC_DONE;
break;
- case LL_LEASE_LAYOUT_MERGE: {
- int fd;
-
+ case LL_LEASE_LAYOUT_MERGE:
if (ioc->lil_count != 1) {
rc = -EINVAL;
goto out_lease_close;
}
arg += sizeof(*ioc);
- if (copy_from_user(&fd, (void __user *)arg, sizeof(u32))) {
+ if (copy_from_user(&fdv, (void __user *)arg, sizeof(u32))) {
rc = -EFAULT;
goto out_lease_close;
}
- layout_file = fget(fd);
+ layout_file = fget(fdv);
if (!layout_file) {
rc = -EBADF;
goto out_lease_close;
@@ -3621,9 +3620,7 @@ static long ll_file_unlock_lease(struct file *file, struct ll_ioc_lease *ioc,
data = file_inode(layout_file);
bias = MDS_CLOSE_LAYOUT_MERGE;
break;
- }
case LL_LEASE_LAYOUT_SPLIT: {
- int fdv;
int mirror_id;
if (ioc->lil_count != 2) {
@@ -3700,29 +3697,24 @@ static long ll_file_unlock_lease(struct file *file, struct ll_ioc_lease *ioc,
if (lease_broken)
fmode = 0;
-
out:
- switch (ioc->lil_flags) {
- case LL_LEASE_RESYNC_DONE:
+ if (ioc->lil_flags == LL_LEASE_RESYNC_DONE && data)
kfree(data);
- break;
- case LL_LEASE_LAYOUT_MERGE:
- case LL_LEASE_LAYOUT_SPLIT:
- if (layout_file)
- fput(layout_file);
- ll_layout_refresh(inode, &fd->fd_layout_version);
- break;
- case LL_LEASE_PCC_ATTACH:
+ if (layout_file)
+ fput(layout_file);
+
+ if (ioc->lil_flags == LL_LEASE_PCC_ATTACH) {
if (!rc)
rc = rc2;
rc = pcc_readwrite_attach_fini(file, inode,
param.pa_layout_gen,
lease_broken, rc,
attached);
- break;
}
+ ll_layout_refresh(inode, &fd->fd_layout_version);
+
if (!rc)
rc = ll_lease_type_from_fmode(fmode);
return rc;
@@ -578,11 +578,6 @@ enum lov_comp_md_entry_flags {
/* The mirror flags sent by client */
#define LCME_MIRROR_FLAGS (LCME_FL_NOSYNC)
-/* the highest bit in obdo::o_layout_version is used to mark if the file is
- * being resynced.
- */
-#define LU_LAYOUT_RESYNC LCME_FL_NEG
-
/* lcme_id can be specified as certain flags, and the first
* bit of lcme_id is used to indicate that the ID is representing
* certain LCME_FL_* but not a real ID. Which implies we can have
@@ -595,6 +590,16 @@ enum lcme_id {
LCME_ID_NOT_ID = LCME_FL_NEG
};
+/* layout version equals to lcme_id, except some bits have special meanings */
+enum layout_version_flags {
+ /* layout version reaches the high water mark to be increased to
+ * circularly reuse the smallest value
+ */
+ LU_LAYOUT_HIGEN = 0x40000000,
+ /* the highest bit is used to mark if the file is being resynced */
+ LU_LAYOUT_RESYNC = 0x80000000,
+};
+
struct lov_comp_md_entry_v1 {
__u32 lcme_id; /* unique id of component */
__u32 lcme_flags; /* LCME_FL_XXX */