Skip to contentSkip to conversation

writev/readv dnotify confusion

DISCUSSION Zou Pengcheng 1 participant 1 message Nov 29, 2002

lore
Share & tools
lore
#0 lore raw

hi,

not sure if dnotify is handled by writev/readv correctly,

below are some code of do_readv_writev() in linux/fs/read_write.c:

out_nofree:

        /* VERIFY_WRITE actually means a read, as we write to user space */
        if ((ret + (type == VERIFY_WRITE)) > 0)
                dnotify_parent(file->f_dentry,
                        (type == VERIFY_WRITE) ? DN_MODIFY : DN_ACCESS);
        return ret;
}

based on this code, it seems writev() sets DN_ACCESS while readv() sets DN_MODIFY.

i have also verified this by writing a testing program, in my testing program, if just do fcntl(fd, F_NOTIFY, DN_MODIFY), on signal is raised after a writev(), if i do fcntl(fd, F_NOTIFY, DN_ACCESS), then get the signal.

so wonder maybe the code above should be modified as something like:

out_nofree:

        /* VERIFY_WRITE actually means a read, as we write to user space */
        if ((ret + (type == VERIFY_WRITE)) > 0)
                dnotify_parent(file->f_dentry,
                        (type == VERIFY_WRITE) ? DN_ACCESS : DN_MODIFY);
        return ret;
}

cheers,