Questions tagged [fsync]

The fsync system call causes all modified data and attributes associated to a given file descriptor to be moved to a permanent storage device.

The fsync system call causes all modified data and attributes associated to a given file descriptor to be moved to a permanent storage device.

http://www.freebsd.org/cgi/man.cgi?query=fsync&sektion=2

101 questions
1
vote
1 answer

does linux fsync will sync file's xattr?

From man fsync(2), it will sync the file's metadata, which i think it's something list in stat. What's about file's xattr? does it belongs to metadata? We did a test, write a file, and set 6 xattrs, then do fsync, then change 1 xattr value, and do…
hjwsm1989
  • 83
  • 1
  • 9
1
vote
1 answer

Redirected output from a subprocess call getting lost?

I have some Python code that goes roughly like this, using some libraries that you may or may not have: # Open it for writing vcf_file = open(local_filename, "w") # Download the region to the file. subprocess.check_call(["bcftools", "view", …
interfect
  • 2,665
  • 1
  • 20
  • 35
1
vote
1 answer

AIO in C on Unix - aio_fsync usage

I can't understand what this function aio_fsync does. I've read man pages and even googled but can't find an understandable definition. Can you explain it in a simple way, preferably with an example?
Greyshack
  • 1,901
  • 7
  • 29
  • 48
1
vote
1 answer

Performance when calling fsync on multiple files vs one file

I have multiple threads each accepting requests, doing some processing, storing the result in a commit log, and returning the results. In order to guarantee that at most x seconds worth of data is lost, this commit log needs to be fsync'd every x…
1
vote
0 answers

Flushing pages to disk in order

Is there a way to impose the order in which pages are flushed from memory to disk in Linux, except updating pages in the desired order and performing fsync()/msync() after each page update, separately? Relates to the linux page cache flush order,…
leventov
  • 14,760
  • 11
  • 69
  • 98
1
vote
1 answer

Is there a posix-way to ensure two files are flushed in sequence without blocking?

In my program, I hold two files open for writing, a content-file, containing chunks of data, and an index-file, containing a map over which chunks of data has been written so far. I would like to flush them both to disc, as performant as possible,…
Rawler
  • 1,480
  • 1
  • 11
  • 23
1
vote
0 answers

fsync's performance got mix result on Linux 2.6.32 ext2 filesystem

While I was testing performance of fsync on my Linux machine, I found fsync costs outstanding time when inserting data into a file which grows the file, but it performs 100 times faster when inserting data that just overrides exsting content and not…
1
vote
0 answers

db.fsyncLock() and db.fsyncUnlock() in MongoDB Database(Auth enabled) get it blocked

I have performed a db.fsyncLock() BackUp orders db.fsyncUnlock() Later, I try to do some common operations in the database,like find() but it is blocked and doesn´t return anything. I have to do a restart of the mongodb to make it work…
X.Otano
  • 2,079
  • 1
  • 22
  • 40
1
vote
1 answer

db.fsyncLock() without permission in MongoDB (auth enabled)

i have added auth to my MongoDB instance. I created a user with the following command db.createUser( { user: "cocodrile", pwd: "amazonas", roles: [ { role: "userAdminAnyDatabase", db: "admin"}, { role: "dbOwner", db: "admin"}, …
X.Otano
  • 2,079
  • 1
  • 22
  • 40
1
vote
1 answer

Can a call to write(2) be interrupted by OS with an fsync(2)

I have a loop of write(2) with arbitrary amount of data + EOL and an fsync(2) appending to a file line by line. Can a crash of the process leave me with a file that has half of the data from the write(2) call written to file? My theory is that if…
Yarek T
  • 9,715
  • 2
  • 28
  • 38
1
vote
0 answers

fclose, fsync and hardware watchdog

I am experiencing an interesting issue that makes no sense to me. I am writing to a file, and 2 seconds later a hardware watchdog is triggered, and the computer resets. However, I am not seeing my last write to the file. I put a print statement…
user2494298
  • 299
  • 3
  • 7
  • 23
1
vote
1 answer

MongoDB verify if fsync is working

I perform fsync() operation in MongoDB, but it just returns immediately. It doesn't appear to have done anything. How do I verify if the data has indeed been flushed to disk at all? NOTE: I set syncdelay to 0 which means that the writes won't be…
Sai
  • 461
  • 7
  • 25
1
vote
2 answers

Why does using fsync() to flush writes to disk speed up access?

We need an app to as much as possible, guarantee that when it reports a record persisted, it really was. I understand that to do this you use fsync(fd). However, for some strange reason, it appears using fsync() speeds up the code that writes to…
Jay
  • 19,649
  • 38
  • 121
  • 184
1
vote
3 answers

How to get open files of a subprocess?

How to get open files of a subprocess? i opened a subprocess which generate files, i want get file descritor of these files to do fsync on them so if i have code like this: p = subprocess.Popen([ 'some_program' ]) the process p generate…
Joseph
  • 3,085
  • 3
  • 23
  • 33
0
votes
1 answer

Does the order/direction of fsync matter?

Let's say I write out some files and directories to a usb thumb drive. /media/drive1/newFolder1/ /media/drive1/newFolder1/newfile1 /media/drive1/newFolder1/newfile2 I've created a folder, newFolder1 and two files newfile1 and newfile2. Syncing does…
Nick
  • 2,913
  • 12
  • 40
  • 52