On Fri, Oct 07, 2016 at 01:41:29AM +0530, Nayna wrote: > Are we trying to say that, once the teardown() is started, no more opening > of files are allowed, even if they are visible ?
Yes. > But if open() has happened first, and then teardown(), in that case private > data is already passed to seq_open(). Yes. > That means here the behaviour will still be same as existing.. No, the crucial difference is that the 'get_device' is now safe. It either acquires a kref or it returns ENODEV. Since we have safely done get_device, and hold a kref, we know the log cannot become freed since you will move the log free to the tpm_dev_release function. tpm_dev_release is called when the chip kref count goes to 0. > opened files continue to access the data, and teardown will not be > waiting for opened files to be closed() ? Is this correct > understanding of what we are trying to do ? Right, no waiting. Instead we defer kfree(chip) until all users are done, including open user files. This is the same approach we use in other parts of the subsystem. Jason ------------------------------------------------------------------------------ Check out the vibrant tech community on one of the world's most engaging tech sites, SlashDot.org! http://sdm.link/slashdot _______________________________________________ tpmdd-devel mailing list tpmdd-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/tpmdd-devel