[PATCH] sheepdog: fix to update data_vdi_id after writing data object

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Previously data_vdi_id was updated although data object was not
written successfully.
That broke inode data and volume data.

This patch changes to update data_vdi_id after writing data
object successfully.

Signed-off-by: Teruaki Ishizaki <ishizaki.teruaki@xxxxxxxxxxxxx>
---
 usr/bs_sheepdog.c | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/usr/bs_sheepdog.c b/usr/bs_sheepdog.c
index 9b5b259..cfaf48b 100644
--- a/usr/bs_sheepdog.c
+++ b/usr/bs_sheepdog.c
@@ -937,14 +937,6 @@ retry:
 
 				oid = vid_to_data_oid(ai->inode.vdi_id, idx);
 
-				ai->min_dirty_data_idx =
-					min_t(uint32_t,
-					      idx, ai->min_dirty_data_idx);
-				ai->max_dirty_data_idx =
-					max_t(uint32_t,
-					      idx, ai->max_dirty_data_idx);
-
-				ai->inode.data_vdi_id[idx] = vid;
 			}
 
 			need_reload_inode = 0;
@@ -966,6 +958,14 @@ retry:
 				}
 
 				if (create) {
+					ai->min_dirty_data_idx =
+						min_t(uint32_t, idx,
+						      ai->min_dirty_data_idx);
+					ai->max_dirty_data_idx =
+						max_t(uint32_t, idx,
+						      ai->max_dirty_data_idx);
+					ai->inode.data_vdi_id[idx] = vid;
+
 					need_update_inode = 1;
 					create = 0;
 				}
-- 
1.8.3.1

--
To unsubscribe from this list: send the line "unsubscribe stgt" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux SCSI]     [Linux RAID]     [Linux Clusters]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]

  Powered by Linux