Opened 12 years ago

Closed 12 years ago

#2158 closed bug (fixed)

BNode::WriteAttr() fails in a directory locked with BNode::Locked().

Reported by: bga Owned by: bga
Priority: normal Milestone: R1
Component: System/Kernel Version: R1/pre-alpha1
Keywords: Cc:
Blocked By: Blocking:
Has a Patch: no Platform: All

Description

Calling BNode::WriteAttr() in a BNode that you created and locked results in you not being able to call WriteAttr() on that very same node. As I understand it, this should not happen as the Lock is to protect access from other entities and not from ourselves. :)

Attachments (1)

testlock.cpp (802 bytes ) - added by bga 12 years ago.
Sample code

Download all attachments as: .zip

Change History (6)

by bga, 12 years ago

Attachment: testlock.cpp added

Sample code

comment:1 by bga, 12 years ago

BTW, just a reminder that in BeOS locking the node does not prevent WriteAttr() to work.

comment:2 by bga, 12 years ago

Component: - GeneralSystem/Kernel

comment:3 by bga, 12 years ago

So I found exactly where the problem lies. In vfs.cpp:

static int get_new_fd(int type, struct fs_mount *mount, struct vnode *vnode,

void *cookie, int openMode, bool kernel)

{

struct file_descriptor *descriptor; int fd;

if the vnode is locked, we don't allow creating a new file descriptor for it if (vnode && vnode->mandatory_locked_by != NULL)

return B_BUSY;

[...]

This is the point where it fails. I guess we should check if the vnode refers to an attribute and allow that to work.

comment:4 by bga, 12 years ago

Owner: changed from axeld to bga

Submitted hrev25162 which probably fixed it. Unless someone complains about this change, I will close this bug.

comment:5 by bga, 12 years ago

Resolution: fixed
Status: newclosed

Ok, this is fixed.

Note: See TracTickets for help on using tickets.