Sean Paul <seanpaul@xxxxxxxxxxxx> writes: > nit: space before , Thanks. >> + /* Clone the lessor file to create a new file for us */ >> + DRM_DEBUG_LEASE("Allocating lease file\n"); >> + path_get(&lessor_file->f_path); > > Please forgive the stupid question, but where is this reference given > up? That's not a stupid question, it's a very subtle one which took me quite a while to sort out. Here's path_get: void path_get(const struct path *path) { mntget(path->mnt); dget(path->dentry); } So, getting a reference on a 'path' actually gets a reference on two of the things it points to. alloc_file is passed the path and doesn't take an additional reference on either of these fields, presumably because the normal path has the caller taking a reference while looking up the object and handing that reference off to alloc_file. In our case, we're creating a new file that refers to the same path as an existing one, so we need another reference. When the file is finally freed in __fput, the two references are dropped at the end of the function: static void __fput(struct file *file) { struct dentry *dentry = file->f_path.dentry; struct vfsmount *mnt = file->f_path.mnt; ... dput(dentry); mntput(mnt); } This was probably the twistiest part of creating a lease. All of the DRM stuff was trivial; getting the core kernel object reference counts right was a pain. >> + if (lessee->lessor == NULL) >> + /* owner can use all objects */ >> + object_idr = &lessee->dev->mode_config.crtc_idr; > > What about other types of objects? If I understand your question correctly, the answer is that 'crtc_idr' is misnamed -- it holds all of the mode setting objects. Thanks for your review, let me know if you have more questions! -- -keith
Attachment:
signature.asc
Description: PGP signature
_______________________________________________ dri-devel mailing list dri-devel@xxxxxxxxxxxxxxxxxxxxx https://lists.freedesktop.org/mailman/listinfo/dri-devel