linux-btrfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [patch] Btrfs: fix some endian bugs handling the root times
@ 2012-07-30  8:10 Dan Carpenter
  2012-08-01 12:17 ` Alexander Block
  0 siblings, 1 reply; 2+ messages in thread
From: Dan Carpenter @ 2012-07-30  8:10 UTC (permalink / raw)
  To: Chris Mason, Alexander Block; +Cc: linux-btrfs, kernel-janitors

"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>
---
Applies to linux-next.

diff --git a/fs/btrfs/ioctl.c b/fs/btrfs/ioctl.c
index 43f0012..a1fbca0 100644
--- a/fs/btrfs/ioctl.c
+++ b/fs/btrfs/ioctl.c
@@ -424,7 +424,7 @@ static noinline int create_subvol(struct btrfs_root *root,
 	uuid_le_gen(&new_uuid);
 	memcpy(root_item.uuid, new_uuid.b, BTRFS_UUID_SIZE);
 	root_item.otime.sec = cpu_to_le64(cur_time.tv_sec);
-	root_item.otime.nsec = cpu_to_le64(cur_time.tv_nsec);
+	root_item.otime.nsec = cpu_to_le32(cur_time.tv_nsec);
 	root_item.ctime = root_item.otime;
 	btrfs_set_root_ctransid(&root_item, trans->transid);
 	btrfs_set_root_otransid(&root_item, trans->transid);
diff --git a/fs/btrfs/transaction.c b/fs/btrfs/transaction.c
index 7ac7cdc..7208ada 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,
 	memcpy(new_root_item->parent_uuid, root->root_item.uuid,
 			BTRFS_UUID_SIZE);
 	new_root_item->otime.sec = cpu_to_le64(cur_time.tv_sec);
-	new_root_item->otime.nsec = cpu_to_le64(cur_time.tv_nsec);
+	new_root_item->otime.nsec = cpu_to_le32(cur_time.tv_nsec);
 	btrfs_set_root_otransid(new_root_item, trans->transid);
 	memset(&new_root_item->stime, 0, sizeof(new_root_item->stime));
 	memset(&new_root_item->rtime, 0, sizeof(new_root_item->rtime));
diff --git a/fs/btrfs/root-tree.c b/fs/btrfs/root-tree.c
index 6bb465c..10d8e4d 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,
 	struct timespec ct = CURRENT_TIME;
 
 	spin_lock(&root->root_times_lock);
-	item->ctransid = trans->transid;
+	item->ctransid = cpu_to_le64(trans->transid);
 	item->ctime.sec = cpu_to_le64(ct.tv_sec);
-	item->ctime.nsec = cpu_to_le64(ct.tv_nsec);
+	item->ctime.nsec = cpu_to_le32(ct.tv_nsec);
 	spin_unlock(&root->root_times_lock);
 }

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [patch] Btrfs: fix some endian bugs handling the root times
  2012-07-30  8:10 [patch] Btrfs: fix some endian bugs handling the root times Dan Carpenter
@ 2012-08-01 12:17 ` Alexander Block
  0 siblings, 0 replies; 2+ messages in thread
From: Alexander Block @ 2012-08-01 12:17 UTC (permalink / raw)
  To: Dan Carpenter; +Cc: Chris Mason, linux-btrfs, kernel-janitors

On Mon, Jul 30, 2012 at 10:10 AM, Dan Carpenter
<dan.carpenter@oracle.com> wrote:
> "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>
> ---
> Applies to linux-next.
>
> diff --git a/fs/btrfs/ioctl.c b/fs/btrfs/ioctl.c
> index 43f0012..a1fbca0 100644
> --- a/fs/btrfs/ioctl.c
> +++ b/fs/btrfs/ioctl.c
> @@ -424,7 +424,7 @@ static noinline int create_subvol(struct btrfs_root *root,
>         uuid_le_gen(&new_uuid);
>         memcpy(root_item.uuid, new_uuid.b, BTRFS_UUID_SIZE);
>         root_item.otime.sec = cpu_to_le64(cur_time.tv_sec);
> -       root_item.otime.nsec = cpu_to_le64(cur_time.tv_nsec);
> +       root_item.otime.nsec = cpu_to_le32(cur_time.tv_nsec);
>         root_item.ctime = root_item.otime;
>         btrfs_set_root_ctransid(&root_item, trans->transid);
>         btrfs_set_root_otransid(&root_item, trans->transid);
> diff --git a/fs/btrfs/transaction.c b/fs/btrfs/transaction.c
> index 7ac7cdc..7208ada 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,
>         memcpy(new_root_item->parent_uuid, root->root_item.uuid,
>                         BTRFS_UUID_SIZE);
>         new_root_item->otime.sec = cpu_to_le64(cur_time.tv_sec);
> -       new_root_item->otime.nsec = cpu_to_le64(cur_time.tv_nsec);
> +       new_root_item->otime.nsec = cpu_to_le32(cur_time.tv_nsec);
>         btrfs_set_root_otransid(new_root_item, trans->transid);
>         memset(&new_root_item->stime, 0, sizeof(new_root_item->stime));
>         memset(&new_root_item->rtime, 0, sizeof(new_root_item->rtime));
> diff --git a/fs/btrfs/root-tree.c b/fs/btrfs/root-tree.c
> index 6bb465c..10d8e4d 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,
>         struct timespec ct = CURRENT_TIME;
>
>         spin_lock(&root->root_times_lock);
> -       item->ctransid = trans->transid;
> +       item->ctransid = cpu_to_le64(trans->transid);
>         item->ctime.sec = cpu_to_le64(ct.tv_sec);
> -       item->ctime.nsec = cpu_to_le64(ct.tv_nsec);
> +       item->ctime.nsec = cpu_to_le32(ct.tv_nsec);
>         spin_unlock(&root->root_times_lock);
>  }

Thanks. I will include this patch in the next send/receive pull request.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2012-08-01 12:17 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-07-30  8:10 [patch] Btrfs: fix some endian bugs handling the root times Dan Carpenter
2012-08-01 12:17 ` Alexander Block

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).