alpha: IOMMU had better access to the free space bitmap at only one place
[sfrench/cifs-2.6.git] / mm / fadvise.c
index 168c78a121bb0f67835dabcae5e3f4edb74e8e7d..3c0f1e99f5e40ad90a116f62a39ca1e0ca3f5fa7 100644 (file)
@@ -38,7 +38,7 @@ asmlinkage long sys_fadvise64_64(int fd, loff_t offset, loff_t len, int advice)
        if (!file)
                return -EBADF;
 
-       if (S_ISFIFO(file->f_dentry->d_inode->i_mode)) {
+       if (S_ISFIFO(file->f_path.dentry->d_inode->i_mode)) {
                ret = -ESPIPE;
                goto out;
        }
@@ -49,9 +49,21 @@ asmlinkage long sys_fadvise64_64(int fd, loff_t offset, loff_t len, int advice)
                goto out;
        }
 
-       if (mapping->a_ops->get_xip_page)
-               /* no bad return value, but ignore advice */
+       if (mapping->a_ops->get_xip_page) {
+               switch (advice) {
+               case POSIX_FADV_NORMAL:
+               case POSIX_FADV_RANDOM:
+               case POSIX_FADV_SEQUENTIAL:
+               case POSIX_FADV_WILLNEED:
+               case POSIX_FADV_NOREUSE:
+               case POSIX_FADV_DONTNEED:
+                       /* no bad return value, but ignore advice */
+                       break;
+               default:
+                       ret = -EINVAL;
+               }
                goto out;
+       }
 
        /* Careful about overflows. Len == 0 means "as much as possible" */
        endbyte = offset + len;