Commit 5efad0a7 authored by Linus Torvalds's avatar Linus Torvalds

Merge tag 'fs_for_v6.7-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/jack/linux-fs

Pull ext2, udf, and quota updates from Jan Kara:

 - conversion of ext2 directory code to use folios

 - cleanups in UDF declarations

 - bugfix for quota interaction with file encryption

* tag 'fs_for_v6.7-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/jack/linux-fs:
  ext2: Convert ext2_prepare_chunk and ext2_commit_chunk to folios
  ext2: Convert ext2_make_empty() to use a folio
  ext2: Convert ext2_unlink() and ext2_rename() to use folios
  ext2: Convert ext2_delete_entry() to use folios
  ext2: Convert ext2_empty_dir() to use a folio
  ext2: Convert ext2_add_link() to use a folio
  ext2: Convert ext2_readdir to use a folio
  ext2: Add ext2_get_folio()
  ext2: Convert ext2_check_page to ext2_check_folio
  highmem: Add folio_release_kmap()
  udf: Avoid unneeded variable length array in struct fileIdentDesc
  udf: Annotate struct udf_bitmap with __counted_by
  quota: explicitly forbid quota files from being encrypted
parents e9806ff8 82dd6206
This diff is collapsed.
......@@ -717,22 +717,17 @@ extern void ext2_init_block_alloc_info(struct inode *);
extern void ext2_rsv_window_add(struct super_block *sb, struct ext2_reserve_window_node *rsv);
/* dir.c */
extern int ext2_add_link (struct dentry *, struct inode *);
extern int ext2_inode_by_name(struct inode *dir,
int ext2_add_link(struct dentry *, struct inode *);
int ext2_inode_by_name(struct inode *dir,
const struct qstr *child, ino_t *ino);
extern int ext2_make_empty(struct inode *, struct inode *);
extern struct ext2_dir_entry_2 *ext2_find_entry(struct inode *, const struct qstr *,
struct page **);
extern int ext2_delete_entry(struct ext2_dir_entry_2 *dir, struct page *page);
extern int ext2_empty_dir (struct inode *);
extern struct ext2_dir_entry_2 *ext2_dotdot(struct inode *dir, struct page **p);
int ext2_make_empty(struct inode *, struct inode *);
struct ext2_dir_entry_2 *ext2_find_entry(struct inode *, const struct qstr *,
struct folio **foliop);
int ext2_delete_entry(struct ext2_dir_entry_2 *dir, struct folio *folio);
int ext2_empty_dir(struct inode *);
struct ext2_dir_entry_2 *ext2_dotdot(struct inode *dir, struct folio **foliop);
int ext2_set_link(struct inode *dir, struct ext2_dir_entry_2 *de,
struct page *page, struct inode *inode, bool update_times);
static inline void ext2_put_page(struct page *page, void *page_addr)
{
kunmap_local(page_addr);
put_page(page);
}
struct folio *folio, struct inode *inode, bool update_times);
/* ialloc.c */
extern struct inode * ext2_new_inode (struct inode *, umode_t, const struct qstr *);
......
......@@ -273,21 +273,21 @@ static int ext2_unlink(struct inode *dir, struct dentry *dentry)
{
struct inode *inode = d_inode(dentry);
struct ext2_dir_entry_2 *de;
struct page *page;
struct folio *folio;
int err;
err = dquot_initialize(dir);
if (err)
goto out;
de = ext2_find_entry(dir, &dentry->d_name, &page);
de = ext2_find_entry(dir, &dentry->d_name, &folio);
if (IS_ERR(de)) {
err = PTR_ERR(de);
goto out;
}
err = ext2_delete_entry(de, page);
ext2_put_page(page, de);
err = ext2_delete_entry(de, folio);
folio_release_kmap(folio, de);
if (err)
goto out;
......@@ -321,9 +321,9 @@ static int ext2_rename (struct mnt_idmap * idmap,
{
struct inode * old_inode = d_inode(old_dentry);
struct inode * new_inode = d_inode(new_dentry);
struct page * dir_page = NULL;
struct folio *dir_folio = NULL;
struct ext2_dir_entry_2 * dir_de = NULL;
struct page * old_page;
struct folio * old_folio;
struct ext2_dir_entry_2 * old_de;
int err;
......@@ -338,19 +338,19 @@ static int ext2_rename (struct mnt_idmap * idmap,
if (err)
return err;
old_de = ext2_find_entry(old_dir, &old_dentry->d_name, &old_page);
old_de = ext2_find_entry(old_dir, &old_dentry->d_name, &old_folio);
if (IS_ERR(old_de))
return PTR_ERR(old_de);
if (S_ISDIR(old_inode->i_mode)) {
err = -EIO;
dir_de = ext2_dotdot(old_inode, &dir_page);
dir_de = ext2_dotdot(old_inode, &dir_folio);
if (!dir_de)
goto out_old;
}
if (new_inode) {
struct page *new_page;
struct folio *new_folio;
struct ext2_dir_entry_2 *new_de;
err = -ENOTEMPTY;
......@@ -358,13 +358,13 @@ static int ext2_rename (struct mnt_idmap * idmap,
goto out_dir;
new_de = ext2_find_entry(new_dir, &new_dentry->d_name,
&new_page);
&new_folio);
if (IS_ERR(new_de)) {
err = PTR_ERR(new_de);
goto out_dir;
}
err = ext2_set_link(new_dir, new_de, new_page, old_inode, true);
ext2_put_page(new_page, new_de);
err = ext2_set_link(new_dir, new_de, new_folio, old_inode, true);
folio_release_kmap(new_folio, new_de);
if (err)
goto out_dir;
inode_set_ctime_current(new_inode);
......@@ -386,19 +386,19 @@ static int ext2_rename (struct mnt_idmap * idmap,
inode_set_ctime_current(old_inode);
mark_inode_dirty(old_inode);
err = ext2_delete_entry(old_de, old_page);
err = ext2_delete_entry(old_de, old_folio);
if (!err && dir_de) {
if (old_dir != new_dir)
err = ext2_set_link(old_inode, dir_de, dir_page,
err = ext2_set_link(old_inode, dir_de, dir_folio,
new_dir, false);
inode_dec_link_count(old_dir);
}
out_dir:
if (dir_de)
ext2_put_page(dir_page, dir_de);
folio_release_kmap(dir_folio, dir_de);
out_old:
ext2_put_page(old_page, old_de);
folio_release_kmap(old_folio, old_de);
return err;
}
......
......@@ -2351,6 +2351,20 @@ static int vfs_setup_quota_inode(struct inode *inode, int type)
if (sb_has_quota_loaded(sb, type))
return -EBUSY;
/*
* Quota files should never be encrypted. They should be thought of as
* filesystem metadata, not user data. New-style internal quota files
* cannot be encrypted by users anyway, but old-style external quota
* files could potentially be incorrectly created in an encrypted
* directory, hence this explicit check. Some reasons why encrypted
* quota files don't work include: (1) some filesystems that support
* encryption don't handle it in their quota_read and quota_write, and
* (2) cleaning up encrypted quota files at unmount would need special
* consideration, as quota files are cleaned up later than user files.
*/
if (IS_ENCRYPTED(inode))
return -EINVAL;
dqopt->files[type] = igrab(inode);
if (!dqopt->files[type])
return -EIO;
......
......@@ -471,7 +471,7 @@ struct fileIdentDesc {
uint8_t lengthFileIdent;
struct long_ad icb;
__le16 lengthOfImpUse;
uint8_t impUse[];
/* uint8_t impUse[]; */
/* uint8_t fileIdent[]; */
/* uint8_t padding[]; */
} __packed;
......
......@@ -86,7 +86,7 @@ struct udf_virtual_data {
struct udf_bitmap {
__u32 s_extPosition;
int s_nr_groups;
struct buffer_head *s_block_bitmap[];
struct buffer_head *s_block_bitmap[] __counted_by(s_nr_groups);
};
struct udf_part_map {
......
......@@ -551,10 +551,24 @@ static inline void folio_zero_range(struct folio *folio,
zero_user_segments(&folio->page, start, start + length, 0, 0);
}
static inline void unmap_and_put_page(struct page *page, void *addr)
/**
* folio_release_kmap - Unmap a folio and drop a refcount.
* @folio: The folio to release.
* @addr: The address previously returned by a call to kmap_local_folio().
*
* It is common, eg in directory handling to kmap a folio. This function
* unmaps the folio and drops the refcount that was being held to keep the
* folio alive while we accessed it.
*/
static inline void folio_release_kmap(struct folio *folio, void *addr)
{
kunmap_local(addr);
put_page(page);
folio_put(folio);
}
static inline void unmap_and_put_page(struct page *page, void *addr)
{
folio_release_kmap(page_folio(page), addr);
}
#endif /* _LINUX_HIGHMEM_H */
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment