mirror of https://github.com/vitalif/e2fsprogs
mkjournal.c (ext2fs_add_journal_inode): When creating a .journal
file on adding a journal to an already-mounted filesystem, try to clear the ext2 file attributes on an already existing .journal file so that we don't fail if on a partially added journal to the filesystem.bitmap-optimize
parent
b3f5b4c229
commit
5bc28df0fa
|
@ -1,5 +1,11 @@
|
|||
2001-11-05 Theodore Tso <tytso@valinux.com>
|
||||
|
||||
* mkjournal.c (ext2fs_add_journal_inode): When creating a .journal
|
||||
file on adding a journal to an already-mounted filesystem,
|
||||
try to clear the ext2 file attributes on an already
|
||||
existing .journal file so that we don't fail if on a
|
||||
partially added journal to the filesystem.
|
||||
|
||||
* ext2_fs.h: Define a new ext2 file attribute, EXT2_NOTAIL_FL,
|
||||
which signals that a particular inode should not have the
|
||||
last bits of data (the "tail") be merged with another
|
||||
|
|
|
@ -327,6 +327,23 @@ errcode_t ext2fs_add_journal_inode(ext2_filsys fs, blk_t size, int flags)
|
|||
if (mount_flags & EXT2_MF_MOUNTED) {
|
||||
strcat(jfile, "/.journal");
|
||||
|
||||
/*
|
||||
* If .../.journal already exists, make sure any
|
||||
* immutable or append-only flags are cleared.
|
||||
*/
|
||||
#if defined(HAVE_CHFLAGS) && defined(UF_NODUMP)
|
||||
(void) chflags (jfile, 0);
|
||||
#else
|
||||
#if HAVE_EXT2_IOCTLS
|
||||
fd = open(jfile, O_RDONLY);
|
||||
if (fd >= 0) {
|
||||
f = 0;
|
||||
ioctl(fd, EXT2_IOC_SETFLAGS, &f);
|
||||
close(fd);
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/* Create the journal file */
|
||||
if ((fd = open(jfile, O_CREAT|O_WRONLY, 0600)) < 0)
|
||||
return errno;
|
||||
|
@ -342,7 +359,7 @@ errcode_t ext2fs_add_journal_inode(ext2_filsys fs, blk_t size, int flags)
|
|||
retval = fchflags (fd, UF_NODUMP|UF_IMMUTABLE);
|
||||
#else
|
||||
#if HAVE_EXT2_IOCTLS
|
||||
f = EXT2_NODUMP_FL | EXT2_IMMUTABLE_FL;;
|
||||
f = EXT2_NODUMP_FL | EXT2_IMMUTABLE_FL;
|
||||
retval = ioctl(fd, EXT2_IOC_SETFLAGS, &f);
|
||||
#endif
|
||||
#endif
|
||||
|
|
Loading…
Reference in New Issue