Git Product home page Git Product logo

Comments (2)

hayley-leblanc avatar hayley-leblanc commented on June 14, 2024

I looked into this issue a bit more and realized that I mischaracterized it originally; the "issue" I described is the expected behavior and not a bug (I was tired and had misinterpreted the output :) ) . However I believe there still is a crash consistency issue with the provided program, although it is actually an issue with write(), not truncate().

memcpy_to_nvmm() is implemented using __copy_from_user_inatomic_nocache() to write file data to PM. This function ultimately uses __copy_user_nocache(), defined here: https://github.com/utsaslab/WineFS/blob/main/Linux-5.1/arch/x86/lib/copy_user_64.S#L197 to perform the non-temporal memcpy. In the documentation for that function, it indicates that __copy_user_nocache() may use temporal memory moves if the destination address or size of the write is not 4 or 8-byte aligned (depending on the size of the entire write). WineFS uses a function pmfs_flush_edge_cachelines() to take care of the beginning and end of the write if they are handled using cached moves.

In the provided test3.cpp file, we write 1 byte, then 1024 bytes. The first write will require a cache line flush, since its size is < 4 bytes. The second write should require two cache line flushes, because although the length of the write is 8-byte aligned, its destination is not. After __copy_user_nocache() handles the first few unaligned bytes, the remaining number of bytes to write will no longer be a multiple of 8, so the final byte will be taken care of via a cached move.

If you add some print statements in pmfs_flush_edge_cachelines() in WineFS to indicate whether each of the if statements runs, and run the provided program, you should see that the first call to write() results in flushing the last cache line (which is expected) but the second call to write() only results in flushing the first cache line. This leaves the very last byte of the write un-flushed, and it could be lost in a crash.

from winefs.

rohankadekodi avatar rohankadekodi commented on June 14, 2024

Thanks! This would lead to data loss if the start and end portions of the data are not loaded in the same set and line. The fix for this issue is in #8

from winefs.

Related Issues (14)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.