hc
2024-12-19 9370bb92b2d16684ee45cf24e879c93c509162da
kernel/fs/nfsd/blocklayout.c
....@@ -15,6 +15,7 @@
1515
1616 #include "blocklayoutxdr.h"
1717 #include "pnfs.h"
18
+#include "filecache.h"
1819
1920 #define NFSDDBG_FACILITY NFSDDBG_PNFS
2021
....@@ -82,13 +83,13 @@
8283 bex->soff = iomap.addr;
8384 break;
8485 }
85
- /*FALLTHRU*/
86
+ fallthrough;
8687 case IOMAP_HOLE:
8788 if (seg->iomode == IOMODE_READ) {
8889 bex->es = PNFS_BLOCK_NONE_DATA;
8990 break;
9091 }
91
- /*FALLTHRU*/
92
+ fallthrough;
9293 case IOMAP_DELALLOC:
9394 default:
9495 WARN(1, "pnfsd: filesystem returned %d extent\n", iomap.type);
....@@ -121,15 +122,13 @@
121122 {
122123 loff_t new_size = lcp->lc_last_wr + 1;
123124 struct iattr iattr = { .ia_valid = 0 };
124
- struct timespec ts;
125125 int error;
126126
127
- ts = timespec64_to_timespec(inode->i_mtime);
128127 if (lcp->lc_mtime.tv_nsec == UTIME_NOW ||
129
- timespec_compare(&lcp->lc_mtime, &ts) < 0)
130
- lcp->lc_mtime = timespec64_to_timespec(current_time(inode));
128
+ timespec64_compare(&lcp->lc_mtime, &inode->i_mtime) < 0)
129
+ lcp->lc_mtime = current_time(inode);
131130 iattr.ia_valid |= ATTR_ATIME | ATTR_CTIME | ATTR_MTIME;
132
- iattr.ia_atime = iattr.ia_ctime = iattr.ia_mtime = timespec_to_timespec64(lcp->lc_mtime);
131
+ iattr.ia_atime = iattr.ia_ctime = iattr.ia_mtime = lcp->lc_mtime;
133132
134133 if (new_size > i_size_read(inode)) {
135134 iattr.ia_valid |= ATTR_SIZE;
....@@ -171,7 +170,7 @@
171170 struct nfs4_client *clp,
172171 struct nfsd4_getdeviceinfo *gdp)
173172 {
174
- if (sb->s_bdev != sb->s_bdev->bd_contains)
173
+ if (bdev_is_partition(sb->s_bdev))
175174 return nfserr_inval;
176175 return nfserrno(nfsd4_block_get_device_info_simple(sb, gdp));
177176 }
....@@ -383,7 +382,7 @@
383382 struct nfs4_client *clp,
384383 struct nfsd4_getdeviceinfo *gdp)
385384 {
386
- if (sb->s_bdev != sb->s_bdev->bd_contains)
385
+ if (bdev_is_partition(sb->s_bdev))
387386 return nfserr_inval;
388387 return nfserrno(nfsd4_block_get_device_info_scsi(sb, clp, gdp));
389388 }
....@@ -406,7 +405,7 @@
406405 nfsd4_scsi_fence_client(struct nfs4_layout_stateid *ls)
407406 {
408407 struct nfs4_client *clp = ls->ls_stid.sc_client;
409
- struct block_device *bdev = ls->ls_file->f_path.mnt->mnt_sb->s_bdev;
408
+ struct block_device *bdev = ls->ls_file->nf_file->f_path.mnt->mnt_sb->s_bdev;
410409
411410 bdev->bd_disk->fops->pr_ops->pr_preempt(bdev, NFSD_MDS_PR_KEY,
412411 nfsd4_scsi_pr_key(clp), 0, true);