* [PATCH] imsm: fix: Allowed to create 2 volumes with total size less then maximum.
@ 2011-11-10 10:51 Lukasz Orlowski
2011-11-10 13:30 ` Labun, Marcin
0 siblings, 1 reply; 3+ messages in thread
From: Lukasz Orlowski @ 2011-11-10 10:51 UTC (permalink / raw)
To: neilb; +Cc: linux-raid, dan.j.williams
mdadm allows to create second volume on the same disk set, whose size is
less then the free space left in the container (with IMSM_NO_PLATFORM
undefined or set to 0). This is an OROM compatibility issue.
It is fixed by verifying whether IMSM_NO_PLATFORM is set and for
the second volume creation scenario, requested size is verified against
remaining available space.
Signed-off-by: Lukasz Orlowski <lukasz.orlowski@intel.com>
---
super-intel.c | 9 +++++++++
1 files changed, 9 insertions(+), 0 deletions(-)
diff --git a/super-intel.c b/super-intel.c
index 215679d..4ebee78 100644
--- a/super-intel.c
+++ b/super-intel.c
@@ -5276,6 +5276,15 @@ static int validate_geometry_imsm_volume(struct supertype *st, int level,
i += dl->extent_cnt;
maxsize = merge_extents(super, i);
+
+ if (!check_env("IMSM_NO_PLATFORM") &&
+ mpb->num_raid_devs > 0 && size && size != maxsize) {
+ fprintf(stderr, Name ": attempting to create a second "
+ "volume with size less then remaining space. "
+ "Aborting...\n");
+ return 0;
+ }
+
if (maxsize < size || maxsize == 0) {
if (verbose)
fprintf(stderr, Name ": not enough space after merge (%llu < %llu)\n",
---------------------------------------------------------------------
Intel Technology Poland sp. z o.o.
z siedziba w Gdansku
ul. Slowackiego 173
80-298 Gdansk
Sad Rejonowy Gdansk Polnoc w Gdansku,
VII Wydzial Gospodarczy Krajowego Rejestru Sadowego,
numer KRS 101882
NIP 957-07-52-316
Kapital zakladowy 200.000 zl
This e-mail and any attachments may contain confidential material for
the sole use of the intended recipient(s). Any review or distribution
by others is strictly prohibited. If you are not the intended
recipient, please contact the sender and delete all copies.
^ permalink raw reply related [flat|nested] 3+ messages in thread
* RE: [PATCH] imsm: fix: Allowed to create 2 volumes with total size less then maximum.
2011-11-10 10:51 [PATCH] imsm: fix: Allowed to create 2 volumes with total size less then maximum Lukasz Orlowski
@ 2011-11-10 13:30 ` Labun, Marcin
2011-11-14 5:43 ` NeilBrown
0 siblings, 1 reply; 3+ messages in thread
From: Labun, Marcin @ 2011-11-10 13:30 UTC (permalink / raw)
To: Orlowski, Lukasz
Cc: neilb@suse.de, linux-raid@vger.kernel.org, Williams, Dan J
Probably it would be more convenient to set the only possible size and create a volume with a warning.
Marcin
> -----Original Message-----
> From: linux-raid-owner@vger.kernel.org [mailto:linux-raid-
> owner@vger.kernel.org] On Behalf Of Lukasz Orlowski
> Sent: Thursday, November 10, 2011 11:52 AM
> To: neilb@suse.de
> Cc: linux-raid@vger.kernel.org; Williams, Dan J
> Subject: [PATCH] imsm: fix: Allowed to create 2 volumes with total size
> less then maximum.
>
> mdadm allows to create second volume on the same disk set, whose size
> is
> less then the free space left in the container (with IMSM_NO_PLATFORM
> undefined or set to 0). This is an OROM compatibility issue.
> It is fixed by verifying whether IMSM_NO_PLATFORM is set and for
> the second volume creation scenario, requested size is verified against
> remaining available space.
>
> Signed-off-by: Lukasz Orlowski <lukasz.orlowski@intel.com>
> ---
> super-intel.c | 9 +++++++++
> 1 files changed, 9 insertions(+), 0 deletions(-)
>
> diff --git a/super-intel.c b/super-intel.c
> index 215679d..4ebee78 100644
> --- a/super-intel.c
> +++ b/super-intel.c
> @@ -5276,6 +5276,15 @@ static int validate_geometry_imsm_volume(struct
> supertype *st, int level,
> i += dl->extent_cnt;
>
> maxsize = merge_extents(super, i);
> +
> + if (!check_env("IMSM_NO_PLATFORM") &&
> + mpb->num_raid_devs > 0 && size && size != maxsize) {
> + fprintf(stderr, Name ": attempting to create a second "
> + "volume with size less then remaining space. "
> + "Aborting...\n");
> + return 0;
> + }
> +
> if (maxsize < size || maxsize == 0) {
> if (verbose)
> fprintf(stderr, Name ": not enough space after merge
> (%llu < %llu)\n",
>
> ---------------------------------------------------------------------
> Intel Technology Poland sp. z o.o.
> z siedziba w Gdansku
> ul. Slowackiego 173
> 80-298 Gdansk
>
> Sad Rejonowy Gdansk Polnoc w Gdansku,
> VII Wydzial Gospodarczy Krajowego Rejestru Sadowego,
> numer KRS 101882
>
> NIP 957-07-52-316
> Kapital zakladowy 200.000 zl
>
> This e-mail and any attachments may contain confidential material for
> the sole use of the intended recipient(s). Any review or distribution
> by others is strictly prohibited. If you are not the intended
> recipient, please contact the sender and delete all copies.
> N�����r��y���b�X��ǧv�^�){.n�+����{�����{ay�\x1dʇڙ�,j\r��f���h���z�\x1e�w���
>
> ���j:+v���w�j�m����\r����zZ+�����ݢj"��!�i
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] imsm: fix: Allowed to create 2 volumes with total size less then maximum.
2011-11-10 13:30 ` Labun, Marcin
@ 2011-11-14 5:43 ` NeilBrown
0 siblings, 0 replies; 3+ messages in thread
From: NeilBrown @ 2011-11-14 5:43 UTC (permalink / raw)
To: Labun, Marcin
Cc: Orlowski, Lukasz, linux-raid@vger.kernel.org, Williams, Dan J
[-- Attachment #1: Type: text/plain, Size: 3104 bytes --]
On Thu, 10 Nov 2011 13:30:32 +0000 "Labun, Marcin" <Marcin.Labun@intel.com>
wrote:
> Probably it would be more convenient to set the only possible size and create a volume with a warning.
> Marcin
I disagree. This code only applies if the user has explicitly requested a
particular size. If that request cannot be fulfilled, it shouldn't be
attempted at all.
I have applied the original patch.
Thanks,
NeilBrown
>
>
> > -----Original Message-----
> > From: linux-raid-owner@vger.kernel.org [mailto:linux-raid-
> > owner@vger.kernel.org] On Behalf Of Lukasz Orlowski
> > Sent: Thursday, November 10, 2011 11:52 AM
> > To: neilb@suse.de
> > Cc: linux-raid@vger.kernel.org; Williams, Dan J
> > Subject: [PATCH] imsm: fix: Allowed to create 2 volumes with total size
> > less then maximum.
> >
> > mdadm allows to create second volume on the same disk set, whose size
> > is
> > less then the free space left in the container (with IMSM_NO_PLATFORM
> > undefined or set to 0). This is an OROM compatibility issue.
> > It is fixed by verifying whether IMSM_NO_PLATFORM is set and for
> > the second volume creation scenario, requested size is verified against
> > remaining available space.
> >
> > Signed-off-by: Lukasz Orlowski <lukasz.orlowski@intel.com>
> > ---
> > super-intel.c | 9 +++++++++
> > 1 files changed, 9 insertions(+), 0 deletions(-)
> >
> > diff --git a/super-intel.c b/super-intel.c
> > index 215679d..4ebee78 100644
> > --- a/super-intel.c
> > +++ b/super-intel.c
> > @@ -5276,6 +5276,15 @@ static int validate_geometry_imsm_volume(struct
> > supertype *st, int level,
> > i += dl->extent_cnt;
> >
> > maxsize = merge_extents(super, i);
> > +
> > + if (!check_env("IMSM_NO_PLATFORM") &&
> > + mpb->num_raid_devs > 0 && size && size != maxsize) {
> > + fprintf(stderr, Name ": attempting to create a second "
> > + "volume with size less then remaining space. "
> > + "Aborting...\n");
> > + return 0;
> > + }
> > +
> > if (maxsize < size || maxsize == 0) {
> > if (verbose)
> > fprintf(stderr, Name ": not enough space after merge
> > (%llu < %llu)\n",
> >
> > ---------------------------------------------------------------------
> > Intel Technology Poland sp. z o.o.
> > z siedziba w Gdansku
> > ul. Slowackiego 173
> > 80-298 Gdansk
> >
> > Sad Rejonowy Gdansk Polnoc w Gdansku,
> > VII Wydzial Gospodarczy Krajowego Rejestru Sadowego,
> > numer KRS 101882
> >
> > NIP 957-07-52-316
> > Kapital zakladowy 200.000 zl
> >
> > This e-mail and any attachments may contain confidential material for
> > the sole use of the intended recipient(s). Any review or distribution
> > by others is strictly prohibited. If you are not the intended
> > recipient, please contact the sender and delete all copies.
> > N�����r��y���b�X��ǧv�^�){.n�+����{�����{ay�\x1dʇڙ�,j\r��f���h���z�\x1e�w���
> >
> > ���j:+v���w�j�m����\r����zZ+�����ݢj"��!�i
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 828 bytes --]
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2011-11-14 5:43 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-11-10 10:51 [PATCH] imsm: fix: Allowed to create 2 volumes with total size less then maximum Lukasz Orlowski
2011-11-10 13:30 ` Labun, Marcin
2011-11-14 5:43 ` NeilBrown
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).