xfs
[Top] [All Lists]

[Bug 307] New: prohibited_mr_events() in dmapi/dmapi_xfs.c unconditional

To: xfs-master@xxxxxxxxxxx
Subject: [Bug 307] New: prohibited_mr_events() in dmapi/dmapi_xfs.c unconditionally prohibits DM_EVENT_READ
From: bugzilla-daemon@xxxxxxxxxxx
Date: Fri, 13 Feb 2004 17:19:21 -0800
Sender: linux-xfs-bounce@xxxxxxxxxxx
http://oss.sgi.com/bugzilla/show_bug.cgi?id=307

           Summary: prohibited_mr_events() in dmapi/dmapi_xfs.c
                    unconditionally prohibits DM_EVENT_READ
           Product: Linux XFS
           Version: Current
          Platform: All
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: Medium
         Component: dmapi
        AssignedTo: xfs-master@xxxxxxxxxxx
        ReportedBy: mmontour@xxxxxxxxxx


In the current CVS checkout (version 1.29 of dmapi/dmapi_xfs.c):

STATIC int
prohibited_mr_events(
        vnode_t         *vp)
{
        struct address_space *mapping = LINVFS_GET_IP(vp)->i_mapping;
        int prohibited = (1 << DM_EVENT_READ);
        struct vm_area_struct *vma;

#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
        down(&mapping->i_shared_sem);
        list_for_each_entry(vma, &mapping->i_mmap_shared, shared) {
                if (!(vma->vm_flags & VM_DENYWRITE)) {
                        prohibited |= (1 << DM_EVENT_WRITE);
                        break;
                }
        }
        up(&mapping->i_shared_sem);
#else
        spin_lock(&mapping->i_shared_lock);
        for (vma = mapping->i_mmap_shared; vma; vma = vma->vm_next) {
                if (!(vma->vm_flags & VM_DENYWRITE)) {
                        prohibited |= (1 << DM_EVENT_WRITE);
                        break;
                }
        }
        spin_unlock(&mapping->i_shared_lock);
#endif

        return prohibited;
}

"prohibited" is initialized to (1 << DM_EVENT_READ) and only OR-ed with other
values in the body of the function. Therefore, prohibited_mr_events() will
prevent the setting of READ events on a file regardless of its i_mapping status.

The previous version of this function checked VN_MAPPED(vp) first:

STATIC int
prohibited_mr_events(
        vnode_t         *vp)
{
        struct address_space *mapping;
        struct vm_area_struct *vma;
        int             prohibited;

        if(!VN_MAPPED(vp))
                return 0;

        prohibited = 1 << DM_EVENT_READ;
        mapping = LINVFS_GET_IP(vp)->i_mapping;
 ...



------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.


<Prev in Thread] Current Thread [Next in Thread>
  • [Bug 307] New: prohibited_mr_events() in dmapi/dmapi_xfs.c unconditionally prohibits DM_EVENT_READ, bugzilla-daemon <=