Bug#283303: [sparc] partman breaks the partition table when swap partition is first on the disk

2004-12-13 Thread Anton Zinoviev
On Sun, Dec 12, 2004 at 09:30:49PM -0500, Jurij Smakov wrote:
 
 The functions are nearly identical, except for one essential difference: 
 the do_mkfs() function (which actually works) calls ped_file_system_close()
 on the newly created filesystem and ped_disk_commit() on the disk, where
 the filesystem was created. The parted_server's function does NOT do that.

Yes, this is a crucial difference in the way parted and partman work.
Parted writes everything to disk after each operation and partman
doesn't.

 So, as experiment, I've modified it, according to the patch below:

 --- partman-61/parted_server.c  2004-09-28 20:08:40.0 -0400
 +++ partman/parted_server.c 2004-12-12 21:22:43.975091672 -0500
 @@ -1621,7 +1621,10 @@
  critical_error(Bad file system type: %s, s_fstype);
  ped_partition_set_system(part, fstype);
  deactivate_exception_handler();
 -fs = timered_file_system_create((part-geom), fstype);
 +if ((fs = timered_file_system_create((part-geom), fstype)) != 
 NULL) {
 +   ped_file_system_close(fs);
 +   ped_disk_commit(disk);
 +   }
  activate_exception_handler();
  oprintf(OK\n);
  if (fs != NULL)

Hm, the parted manual was not clear whether the new file system data
structure has to be closed so this can be the problem.

Can you try whether this works if you remove the ped_disk_commit
command?

Anton Zinoviev




-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of unsubscribe. Trouble? Contact [EMAIL PROTECTED]


Bug#283303: [sparc] partman breaks the partition table when swap partition is first on the disk

2004-12-13 Thread Jurij Smakov
Hi,
On Mon, 13 Dec 2004, Anton Zinoviev wrote:
[skip]
Hm, the parted manual was not clear whether the new file system data
structure has to be closed so this can be the problem.
Can you try whether this works if you remove the ped_disk_commit
command?
Anton Zinoviev
Yes, I have tried it withoud ped_disk commit and it didn't fix the bug. It 
seems like ped_disk_commit is necessary. Luckily, it looks like I've 
figured out how to do it with swap enabled on the same disk, check my 
message with subject [sparc] updated parted_server.c patch in the bug 
trail or at http://lists.debian.org/debian-boot/2004/12/msg00626.html

Best regards,
Jurij Smakov[EMAIL PROTECTED]
Key: http://www.wooyd.org/pgpkey/   KeyID: C99E03CC
--
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of unsubscribe. Trouble? Contact [EMAIL PROTECTED]


Bug#283303: [sparc] partman breaks the partition table when swap partition is first on the disk

2004-12-12 Thread Jurij Smakov
Hello,
As previously noted (see bug trail), this failure is due to the 
CREATE_FILE_SYSTEM call to the parted server. I've tried to figure out why 
it fails. For that I've compared the function for filesystem creation in 
parted_server (command_create_file_system() in parted_server.c of partman 
package) and in parted (do_mkfs() in parted/parted.c of parted package). 
The functions are nearly identical, except for one essential difference: 
the do_mkfs() function (which actually works) calls ped_file_system_close()
on the newly created filesystem and ped_disk_commit() on the disk, where
the filesystem was created. The parted_server's function does NOT do that.
So, as experiment, I've modified it, according to the patch below:

--- partman-61/parted_server.c  2004-09-28 20:08:40.0 -0400
+++ partman/parted_server.c 2004-12-12 21:22:43.975091672 -0500
@@ -1621,7 +1621,10 @@
 critical_error(Bad file system type: %s, s_fstype);
 ped_partition_set_system(part, fstype);
 deactivate_exception_handler();
-fs = timered_file_system_create((part-geom), fstype);
+if ((fs = timered_file_system_create((part-geom), fstype)) != NULL) {
+   ped_file_system_close(fs);
+   ped_disk_commit(disk);
+   }
 activate_exception_handler();
 oprintf(OK\n);
 if (fs != NULL)
This change appeared to be a step in the right direction, but not 
sufficient to solve the problem. With this patch applied the partman would
actually hang when committing changes to disk, because all the 50format-*
scripts in /var/lib/partman try to enable swap. Once swap (which is 
formatted first) is activated, the ped_disk_commit() operation cannot be 
performed, as it requires all the partitions on the disk in question not 
to be in use. To work around that I have removed enable_swap command from 
the following files:

/lib/partman/commit.d/50format_basicfilesystems
/lib/partman/commit.d/50format_ext3
/lib/partman/commit.d/50format_jfs
/lib/partman/commit.d/50format_reiserfs
/lib/partman/commit.d/50format_xfs
and added a file /lib/partman/commit.d/99enable_swap with contents
#!/bin/sh
. /lib/partman/definitions.sh
enable_swap
With all these changes the partitions were created correctly and swap got 
activated. Unfortunately (thanks to Thiemo Seufer for pointing it out), 
that's not a very good idea, since on low-memory systems swap is really 
required to perform the filesystem formatting.

Best regards,
Jurij Smakov[EMAIL PROTECTED]
Key: http://www.wooyd.org/pgpkey/   KeyID: C99E03CC
--
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of unsubscribe. Trouble? Contact [EMAIL PROTECTED]