* [Ocfs2-devel] [PATCH] ocfs2: Limit default local alloc size within bitmap range.
@ 2010-06-09 8:43 Tao Ma
2010-06-09 8:52 ` tristan
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Tao Ma @ 2010-06-09 8:43 UTC (permalink / raw)
To: ocfs2-devel
In commit 6b82021b9e91cd689fdffadbcdb9a42597bbe764, we increase
our local alloc size and calculate how much megabytes we can
get according to group size and volume size.
But we also need to check the maximum bits a local alloc block
bitmap can have. With a bs=512, cs=32K, local volume with 160G,
it calculate 96MB while the maximum local alloc size is only
76M. So the bitmap will overflow and corrupt the system truncate
log file. See bug
http://oss.oracle.com/bugzilla/show_bug.cgi?id=1262
Cc: Mark Fasheh <mfasheh@suse.com>
Signed-off-by: Tao Ma <tao.ma@oracle.com>
---
fs/ocfs2/localalloc.c | 7 +++++++
1 files changed, 7 insertions(+), 0 deletions(-)
diff --git a/fs/ocfs2/localalloc.c b/fs/ocfs2/localalloc.c
index 3d74196..ec6adbf 100644
--- a/fs/ocfs2/localalloc.c
+++ b/fs/ocfs2/localalloc.c
@@ -118,6 +118,7 @@ unsigned int ocfs2_la_default_mb(struct ocfs2_super *osb)
{
unsigned int la_mb;
unsigned int gd_mb;
+ unsigned int la_max_mb;
unsigned int megs_per_slot;
struct super_block *sb = osb->sb;
@@ -182,6 +183,12 @@ unsigned int ocfs2_la_default_mb(struct ocfs2_super *osb)
if (megs_per_slot < la_mb)
la_mb = megs_per_slot;
+ /* We can't store more bits than we can in a block. */
+ la_max_mb = ocfs2_clusters_to_megabytes(osb->sb,
+ ocfs2_local_alloc_size(sb) * 8);
+ if (la_mb > la_max_mb)
+ la_mb = la_max_mb;
+
return la_mb;
}
--
1.5.5
^ permalink raw reply related [flat|nested] 4+ messages in thread* [Ocfs2-devel] [PATCH] ocfs2: Limit default local alloc size within bitmap range.
2010-06-09 8:43 [Ocfs2-devel] [PATCH] ocfs2: Limit default local alloc size within bitmap range Tao Ma
@ 2010-06-09 8:52 ` tristan
2010-06-09 22:14 ` Mark Fasheh
2010-06-16 21:23 ` Joel Becker
2 siblings, 0 replies; 4+ messages in thread
From: tristan @ 2010-06-09 8:52 UTC (permalink / raw)
To: ocfs2-devel
Tested-by: Tristan Ye <tristan.ye@oracle.com>
Tao Ma wrote:
> In commit 6b82021b9e91cd689fdffadbcdb9a42597bbe764, we increase
> our local alloc size and calculate how much megabytes we can
> get according to group size and volume size.
> But we also need to check the maximum bits a local alloc block
> bitmap can have. With a bs=512, cs=32K, local volume with 160G,
> it calculate 96MB while the maximum local alloc size is only
> 76M. So the bitmap will overflow and corrupt the system truncate
> log file. See bug
> http://oss.oracle.com/bugzilla/show_bug.cgi?id=1262
>
> Cc: Mark Fasheh <mfasheh@suse.com>
> Signed-off-by: Tao Ma <tao.ma@oracle.com>
> ---
> fs/ocfs2/localalloc.c | 7 +++++++
> 1 files changed, 7 insertions(+), 0 deletions(-)
>
> diff --git a/fs/ocfs2/localalloc.c b/fs/ocfs2/localalloc.c
> index 3d74196..ec6adbf 100644
> --- a/fs/ocfs2/localalloc.c
> +++ b/fs/ocfs2/localalloc.c
> @@ -118,6 +118,7 @@ unsigned int ocfs2_la_default_mb(struct ocfs2_super *osb)
> {
> unsigned int la_mb;
> unsigned int gd_mb;
> + unsigned int la_max_mb;
> unsigned int megs_per_slot;
> struct super_block *sb = osb->sb;
>
> @@ -182,6 +183,12 @@ unsigned int ocfs2_la_default_mb(struct ocfs2_super *osb)
> if (megs_per_slot < la_mb)
> la_mb = megs_per_slot;
>
> + /* We can't store more bits than we can in a block. */
> + la_max_mb = ocfs2_clusters_to_megabytes(osb->sb,
> + ocfs2_local_alloc_size(sb) * 8);
> + if (la_mb > la_max_mb)
> + la_mb = la_max_mb;
> +
> return la_mb;
> }
>
^ permalink raw reply [flat|nested] 4+ messages in thread* [Ocfs2-devel] [PATCH] ocfs2: Limit default local alloc size within bitmap range.
2010-06-09 8:43 [Ocfs2-devel] [PATCH] ocfs2: Limit default local alloc size within bitmap range Tao Ma
2010-06-09 8:52 ` tristan
@ 2010-06-09 22:14 ` Mark Fasheh
2010-06-16 21:23 ` Joel Becker
2 siblings, 0 replies; 4+ messages in thread
From: Mark Fasheh @ 2010-06-09 22:14 UTC (permalink / raw)
To: ocfs2-devel
On Wed, Jun 09, 2010 at 04:43:05PM +0800, Tao Ma wrote:
> In commit 6b82021b9e91cd689fdffadbcdb9a42597bbe764, we increase
> our local alloc size and calculate how much megabytes we can
> get according to group size and volume size.
> But we also need to check the maximum bits a local alloc block
> bitmap can have. With a bs=512, cs=32K, local volume with 160G,
> it calculate 96MB while the maximum local alloc size is only
> 76M. So the bitmap will overflow and corrupt the system truncate
> log file. See bug
> http://oss.oracle.com/bugzilla/show_bug.cgi?id=1262
>
Signed-off-by: Mark Fasheh <mfasheh@suse.com>
--Mark
--
Mark Fasheh
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Ocfs2-devel] [PATCH] ocfs2: Limit default local alloc size within bitmap range.
2010-06-09 8:43 [Ocfs2-devel] [PATCH] ocfs2: Limit default local alloc size within bitmap range Tao Ma
2010-06-09 8:52 ` tristan
2010-06-09 22:14 ` Mark Fasheh
@ 2010-06-16 21:23 ` Joel Becker
2 siblings, 0 replies; 4+ messages in thread
From: Joel Becker @ 2010-06-16 21:23 UTC (permalink / raw)
To: ocfs2-devel
On Wed, Jun 09, 2010 at 04:43:05PM +0800, Tao Ma wrote:
> In commit 6b82021b9e91cd689fdffadbcdb9a42597bbe764, we increase
> our local alloc size and calculate how much megabytes we can
> get according to group size and volume size.
> But we also need to check the maximum bits a local alloc block
> bitmap can have. With a bs=512, cs=32K, local volume with 160G,
> it calculate 96MB while the maximum local alloc size is only
> 76M. So the bitmap will overflow and corrupt the system truncate
> log file. See bug
> http://oss.oracle.com/bugzilla/show_bug.cgi?id=1262
>
> Cc: Mark Fasheh <mfasheh@suse.com>
> Signed-off-by: Tao Ma <tao.ma@oracle.com>
This patch is now in the 'fixes' branch of ocfs2.git.
Joel
--
"The question of whether computers can think is just like the question
of whether submarines can swim."
- Edsger W. Dijkstra
Joel Becker
Principal Software Developer
Oracle
E-mail: joel.becker at oracle.com
Phone: (650) 506-8127
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2010-06-16 21:23 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-06-09 8:43 [Ocfs2-devel] [PATCH] ocfs2: Limit default local alloc size within bitmap range Tao Ma
2010-06-09 8:52 ` tristan
2010-06-09 22:14 ` Mark Fasheh
2010-06-16 21:23 ` Joel Becker
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.