linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* rename problem on vfat file systems
@ 2001-06-21 19:04 abc abc
  2001-06-21 19:12 ` Alexander Viro
  0 siblings, 1 reply; 2+ messages in thread
From: abc abc @ 2001-06-21 19:04 UTC (permalink / raw)
  To: linux-kernel

Hi,

I have been having problems using rename system call
on vfat file systems. I have looked at the kernel code
and tried everything I could do to figure out what
might be going wrong. As a last resort I thought you
might be able to help me.

The /etc/fstab entry for the drive that I mount looks
like this

/dev/sdc1 /mnt/sns-c vfat noauto,sync,user 0 0

here's the code snippet of what I am trying to do

int copy_seg_file(char *segFile)
{
  char command[128];
  sprintf(command, "cp %s /mnt/sns-c/tmp/segfile",
          *segFile);
  system(command);
  sync();
  rename("/mnt/sns-c/tmp/segfile",
         "/mnt/sns-c/segments/segfile");
  printf("file copied\n");
}

initially the file is copied to the temporary
directory to deal with the power outage during the
file copy. Once the file is completely copied, it will
be renamed to the final destination.

If I reboot the machine just after the rename() call
is completed, when the machine comes up the file
/mnt/sns-c/segments/segfile has zero bytes and there
is no file in the tmp directory. Effectively the file
is lost some where. Running fsck recovers the file,
but it doesn't help me much because I would be copying
hundreds of files and its difficult to match the
files.

Can you think of any thing that might be causing this.
Any help is highly appreciated.

Thanks,
Kumar

__________________________________________________
Do You Yahoo!?
Get personalized email addresses from Yahoo! Mail
http://personal.mail.yahoo.com/

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: rename problem on vfat file systems
  2001-06-21 19:04 rename problem on vfat file systems abc abc
@ 2001-06-21 19:12 ` Alexander Viro
  0 siblings, 0 replies; 2+ messages in thread
From: Alexander Viro @ 2001-06-21 19:12 UTC (permalink / raw)
  To: abc abc; +Cc: linux-kernel



On Thu, 21 Jun 2001, abc abc wrote:

> If I reboot the machine just after the rename() call
> is completed, when the machine comes up the file
> /mnt/sns-c/segments/segfile has zero bytes and there
> is no file in the tmp directory. Effectively the file
> is lost some where. Running fsck recovers the file,
> but it doesn't help me much because I would be copying
> hundreds of files and its difficult to match the
> files.
> 
> Can you think of any thing that might be causing this.

Crappy filesystem layout. If you want to do something a-la journalling
for VFAT - seek professional help.


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2001-06-21 19:12 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-06-21 19:04 rename problem on vfat file systems abc abc
2001-06-21 19:12 ` Alexander Viro

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).