On Tue, 2006-11-28 at 14:20 +0100, Szakacsits Szabolcs wrote:
> On Tue, 28 Nov 2006, Anton Altaparmakov wrote:
> > On Tue, 2006-11-28 at 13:08 +0100, Szakacsits Szabolcs wrote:
> > > 
> > > There are two NTFS during resizing. The original and the resized. When 
> > > the resizing is over then the latter is consistent and the old one is
> > > irrelevant. ntfsresize doesn't work like the other utilities: mount, 
> > > modify,
> > > umount. It works like: mount and morph the original into a new one.
> [...] 
> > I cannot see anywhere you having two different ntfs_volume structures.
> > Apologies if I have missed it.  Perhaps you can point out the code to me
> > where you have two volumes as I cannot see it...
> 
> relocate_inodes(), relocate_inode(), especially the $MFT part. There is a
> strict order in what and when is relocated. At some point ntfs_volume is
> mostly used only for reading and a new NTFS gets written.

That is not true, at least not in the code that I am reading here!  It
may have been your intention perhaps but you failed to code it...

Look:

relocate_inodes() -> relocate_inode() -> at the end of the function
calls write_mft_record() which uses the ntfs_volume and the libntfs
function ntfs_mft_record_write() to do the writing.

After that we have truncate_badclust_file() and truncate_bitmap_file()
both of which use write_mft_record() also...

After that we have update_bootsector() and then ntfsresize is finished.

So the only thing that does not use the ntfs_volume for writing is the
final update_bootsector() call...

If you consider it safe to call ntfs_mft_record_write() right until the
end of ntfsresize execution you must also consider it safe to unmount
the volume up to that point.

What am I missing?

> Anything must be modified before it gets relocated, never afterwards. 
> Your change broke this very serious rule.

Yes, and I do not see anything wrong with that.  ntfsresize should keep
the ntfs_volume in sync at all times and then it can be safely
unmounted.  If it does not do that than ntfsresize is arguably broken by
design.

Remember that what you were doing was not working for Vista and it works
now...

Anyway, given ntfsresize is your code, if you want to insist on not
allowing unmounting, then can you please tell me the exact point in the
code at which unmounting becomes dangerous/wrong and we can turn it off
at that point by simply doing "g_vol = NULL;" in the code at that point.

>From what you have said so far that point in time should be the call to
prepare_volume_fixup(), do you agree?

If yes, then simply adding g_vol = NULL; to the end of
prepare_volume_fixup() would do the trick...

I have done this now (see CVS).  Happy now?  (-:

> > However, given things still work, and given that ntfsresize now works
> > for Vista for me when it did not do so before I would say unmounting is
> > both safe and required for ntfsresize.  (-;
> 
> There is a huge difference between the "works for me" and "always works".

Certainly but given it was broken to start with "works for me" and
"never works for Vista" is more like the real comparison here and the
"works for me" is a big improvement...  (-;

Best regards,

        Anton
-- 
Anton Altaparmakov <aia21 at cam.ac.uk> (replace at with @)
Unix Support, Computing Service, University of Cambridge, CB2 3QH, UK
Linux NTFS maintainer, http://www.linux-ntfs.org/



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

Reply via email to