On 7/3/07, Bryan Henderson <hbryan@xxxxxxxxxx> wrote:
>>we want a open/close consistency in snapshots. > >This depends on the transaction engine in your filesystem. None of the >existing linux filesystems have a way to start a transaction when the >file opens and finish it when the file closes, or a way to roll back >individual operations that have happened inside a given transaction. > >It certainly could be done, but it would also introduce a great deal of >complexity to the FS. And I would be opposed as a matter of architecture to making open/close transactional. People often read more into open/close than is there, but open is just about gaining access and close is just about releasing resources. It isn't appropriate for close to _mean_ anything. There are filesystems that have transactions. They use separate start transaction / end transaction system calls (not POSIX). >> Pausing apps itself >> does not solve this problem, because a file could be already opened >> and in the middle of write. Just to be clear: we're saying "pause," but we mean "quiesce." I.e., tell the application to reach a point where it's not in the middle of anything and then tell you it's there. Indeed, whether you use open/close or some other kind of transaction, just pausing the application doesn't help. If you were to implement open/close transactions, the filesystem driver would just wait for the application to close and in the meantime block all new opens.
If we want to support open/close consistency, maybe we don't really need the help from the application. For example, the filesystem is implemented this way. When a file is opened for write, we copy the metadata and create a CoW bitmap to keep track what has been changed. Before writing any new data to the file, we copy the old data and then write the new data. As such, when we take snapshot and encounter the opened file, we can save the old data instead of the newdata, since the old data is in a consistent state. Of course, new file opening should also be handled this way. The filesystem driver cannot wait for application to close, I think. If the application is snapshot aware, the wait time could be tolerable. But if the application does not provide a way to process the quience request, the wait could be infinite. What do you think?
-- Bryan Henderson IBM Almaden Research Center San Jose CA Filesystems
- To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html