aboutsummaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorDan Carpenter <dan.carpenter@oracle.com>2012-07-30 04:10:44 -0400
committerChris Mason <chris.mason@oracle.com>2012-08-28 16:53:26 -0400
commitdadd1105ca9a1e506c678e8e410e9623efdda821 (patch)
tree949d3c7e461fea1df29650fa7fd2c4da23f605f7 /fs
parent55e591ffde38e0088b022129e035e18a8d04c7e6 (diff)
Btrfs: fix some endian bugs handling the root times
"trans->transid" is cpu endian but we want to store the data as little endian. "item->ctime.nsec" is only 32 bits, not 64. Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Diffstat (limited to 'fs')
-rw-r--r--fs/btrfs/ioctl.c2
-rw-r--r--fs/btrfs/root-tree.c4
-rw-r--r--fs/btrfs/transaction.c2
3 files changed, 4 insertions, 4 deletions
diff --git a/fs/btrfs/ioctl.c b/fs/btrfs/ioctl.c
index 43f0012016e3..a1fbca0a1003 100644
--- a/fs/btrfs/ioctl.c
+++ b/fs/btrfs/ioctl.c
@@ -424,7 +424,7 @@ static noinline int create_subvol(struct btrfs_root *root,
424 uuid_le_gen(&new_uuid); 424 uuid_le_gen(&new_uuid);
425 memcpy(root_item.uuid, new_uuid.b, BTRFS_UUID_SIZE); 425 memcpy(root_item.uuid, new_uuid.b, BTRFS_UUID_SIZE);
426 root_item.otime.sec = cpu_to_le64(cur_time.tv_sec); 426 root_item.otime.sec = cpu_to_le64(cur_time.tv_sec);
427 root_item.otime.nsec = cpu_to_le64(cur_time.tv_nsec); 427 root_item.otime.nsec = cpu_to_le32(cur_time.tv_nsec);
428 root_item.ctime = root_item.otime; 428 root_item.ctime = root_item.otime;
429 btrfs_set_root_ctransid(&root_item, trans->transid); 429 btrfs_set_root_ctransid(&root_item, trans->transid);
430 btrfs_set_root_otransid(&root_item, trans->transid); 430 btrfs_set_root_otransid(&root_item, trans->transid);
diff --git a/fs/btrfs/root-tree.c b/fs/btrfs/root-tree.c
index 6bb465cca20f..10d8e4d88071 100644
--- a/fs/btrfs/root-tree.c
+++ b/fs/btrfs/root-tree.c
@@ -544,8 +544,8 @@ void btrfs_update_root_times(struct btrfs_trans_handle *trans,
544 struct timespec ct = CURRENT_TIME; 544 struct timespec ct = CURRENT_TIME;
545 545
546 spin_lock(&root->root_times_lock); 546 spin_lock(&root->root_times_lock);
547 item->ctransid = trans->transid; 547 item->ctransid = cpu_to_le64(trans->transid);
548 item->ctime.sec = cpu_to_le64(ct.tv_sec); 548 item->ctime.sec = cpu_to_le64(ct.tv_sec);
549 item->ctime.nsec = cpu_to_le64(ct.tv_nsec); 549 item->ctime.nsec = cpu_to_le32(ct.tv_nsec);
550 spin_unlock(&root->root_times_lock); 550 spin_unlock(&root->root_times_lock);
551} 551}
diff --git a/fs/btrfs/transaction.c b/fs/btrfs/transaction.c
index 7ac7cdcc294e..7208ada41e0e 100644
--- a/fs/btrfs/transaction.c
+++ b/fs/btrfs/transaction.c
@@ -1061,7 +1061,7 @@ static noinline int create_pending_snapshot(struct btrfs_trans_handle *trans,
1061 memcpy(new_root_item->parent_uuid, root->root_item.uuid, 1061 memcpy(new_root_item->parent_uuid, root->root_item.uuid,
1062 BTRFS_UUID_SIZE); 1062 BTRFS_UUID_SIZE);
1063 new_root_item->otime.sec = cpu_to_le64(cur_time.tv_sec); 1063 new_root_item->otime.sec = cpu_to_le64(cur_time.tv_sec);
1064 new_root_item->otime.nsec = cpu_to_le64(cur_time.tv_nsec); 1064 new_root_item->otime.nsec = cpu_to_le32(cur_time.tv_nsec);
1065 btrfs_set_root_otransid(new_root_item, trans->transid); 1065 btrfs_set_root_otransid(new_root_item, trans->transid);
1066 memset(&new_root_item->stime, 0, sizeof(new_root_item->stime)); 1066 memset(&new_root_item->stime, 0, sizeof(new_root_item->stime));
1067 memset(&new_root_item->rtime, 0, sizeof(new_root_item->rtime)); 1067 memset(&new_root_item->rtime, 0, sizeof(new_root_item->rtime));