Buffer not freed in uffs_DeleteObject

15 views
Skip to first unread message

Frédéric SERGENT

unread,
Feb 2, 2012, 4:59:43 AM2/2/12
to uf...@googlegroups.com
hi Ricky,

I am currently working with very recent changes taken from Git. I think there is a new issue in uffs_DeleteObject: in this version, there is a call to a new function, _CheckObjBufRef. I understand that it replaces the check of references counting on just the FILE or DIR buf by a check on all bufs related to the object. But in the previous version, the FILE or DIR block was then marked as  UFFS_BUF_EMPTY. It does not anymore, leading to confusion when opening an object that reuses the same serial number, and thus, reuse one these blocks. Typically, I had a problem when creating a file right after deleting a directory: I found myself with a file that used a buffer typified as a directory, leading to fatal errors.

I just re-added these 2 lines:

(...)
    if (_CheckObjBufRef(obj) > 0) {
        if (err)
            *err = UEACCES;
        goto ext_lock;
    }
   
    uffs_Buf *buf = uffs_BufFind(dev, obj->parent, obj->serial, 0);
    buf->mark = UFFS_BUF_EMPTY; //!< make this buffer expired.

    node = obj->node;
(...)

Apparently, it solved my problem, but I am not sure if this is enough: if there is a need to check reference counting on all buf used by a file, maybe there is also a need to mark them all as UFFS_BUF_EMPTY?

Could you please have a look at this?

Thanks,
Fred




Ricky Zheng

unread,
Feb 2, 2012, 6:22:27 AM2/2/12
to uf...@googlegroups.com
Thanks for the bug report.

Indeed, there are more page buffer need to be set to UFFS_BUF_EMPTY.
I've fixed this in commit f392bc, please pull master branch.

Regards,
Ricky

2012/2/2 Frédéric SERGENT <fred.se...@gmail.com>





--
You received this message because you are subscribed to the Google Groups "UFFS" group.
To view this discussion on the web visit https://groups.google.com/d/msg/uffs/-/zO6YnsSSF-EJ.
To post to this group, send email to uf...@googlegroups.com.
To unsubscribe from this group, send email to uffs+uns...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/uffs?hl=en.

Frédéric SERGENT

unread,
Feb 2, 2012, 6:52:06 AM2/2/12
to uf...@googlegroups.com

Ok, thanks a lot, I'll get the newer version.

Regards,
Fred
Ricky

2012/2/2 Frédéric SERGENT <fred.se...@gmail.com>
To unsubscribe from this group, send email to uffs+unsubscribe@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages